I’m working on a plugin which will involve accepting PayPal Instant Payment Notifications. IPNs are a web-hook which gets called when a payment is processed. Currently I have a script to handle the IPNs within the plugin e.g.
http://mywordpressinstall.com/wp-content/plugins/paypalplugin/IPNHandler.php
I then paste this URL into the PayPal developer settings area.
I’d like to use a more customizable location for the IPN handler (with a friendlier URL).
I was thinking maybe a shortcode could be used to give ‘handler’ functionality to any page it’s inserted in. Is this a sensible idea? Does anyone have any suggestion on how I can make the URL of the handler shorter?
Thanks!
You can hook to the init action and then check for the query variable, you can use the PayPal provided query var or you can use your own custom query var.
I will give you example of your own custom query var i.e MYIPN_LISTENER
The Code:
Now you can use any URL but it should have MYIPN_LISTENER as a query var e.g: http://mywordpressinstall.com/?MYIPN_LISTENER=1