XF 2.2 PayPal IPN override?

sdchan

Member
I am trying to set up a connection between my PayPal business account, which receives XF payments, and something like Google Sheets or Zapier. My ultimate goal is to run some subscription analytics in a software like ChartMogul (they require PayPal data via IPN). Currently, the IPN URL is overwritten by XF developers / back-end - I found this out via researching this issue.

Is there a way to change the IPN URL set by XF from ping'ing XF to ping'ing a IPN relay service (i.e. Zapier's IPN relay service), so I can forward PayPal transaction data to BOTH XF and another service of my choosing? The issue I'm having is the IPN override by XF is limiting my ability to use PayPal data in other places.

Here is information on the Zapier relay service: https://zapier.com/help/doc/how-use-multiple-ipns-paypal

Here is what Zapier is saying about IPN override: Note: If the plugin/service overrides Zapier's IPN URL in your PayPal account, you'll need to disable it to allow Zapier's URL to persist as the default IPN URL.

As a workaround, can I disable the PayPal payment profile in the admin control panel and capture the XF URL in the IPN forwarding service - https://site.com/payment_callback.php?_xfProvider=paypal. Could this be an option? I'm not sure if the XF integration needs to activated for other reasons as well...
 

sdchan

Member
As a workaround, can I disable the PayPal payment profile in the admin control panel and capture the XF URL in the IPN forwarding service - https://site.com/payment_callback.php?_xfProvider=paypal. Could this be an option? I'm not sure if the XF integration needs to activated for other reasons as well...
Just realizing I cannot disable the PayPal payment profile, otherwise users won't be able to select it as a payment method in the first place. Would be interested in another solution.
 

gigipmc

Member
If I understand your description correctly, you want to forward transactions that are logged in XF (e.g. payments sent from XF to Paypal) to a 3rd party service. If that's the case, you need code that will listen to the XF transaction events and take action when these events occur (e.g. fetch the additional transaction data from Paypal and forward it elsewhere). There doesn't seem to be a need to override anything, it's just additional code.
 

sdchan

Member
Yes, I'm trying to forward transactions that are logged in XF to a 3rd party service. However, the ability to do this is already built in to PayPal (the IPN feature). I could use PayPal's IPN feature if XF didn't override the forwarding URL.

Your suggestion works, however I do need to find a developer and spend money on additional code. I'd rather rely on PayPal's feature, which is supported by PayPal, than hire a developer to build something that may not always work in the future, and may need additional maintenance.

Also, your suggestion of listening to XF transaction events, then tapping into PayPal, and then forwarding information to the 3rd party service, seems a bit complex (building connections between three systems?). I'm sure it could work, but I'd like to keep this as simple as possible - disabling the the XF override but still allowing XF to get the payment data it needs via the IPN forwarding service seems like a quick and simple solution.
 

Chris D

XenForo developer
Staff member
This is more of a dev discussion so I will move it there. If you're not a developer yourself you may need to employ the services of a developer to help you do this.

But in brief, the "callback URL" is set in our XF\Payment\AbstractProvider class:

PHP:
public function getCallbackUrl()
{
   return \XF::app()->options()->boardUrl . '/payment_callback.php?_xfProvider=' . $this->providerId;
}

A developer can easily extend our XF\Payment\PayPal class and extend this method so that a different notify_url is set in our calls to PayPal.

That would enable you to set that to whatever endpoint you want. As long as that endpoint is capable of then relaying the IPN to our default URL (<boardUrl>/payment_callback.php?_xfProvider=paypal) it shouldn't interfere with the normal operation of user upgrades, etc.
 

sdchan

Member
@Chris D is there a way to also include cancelation notifications in the override? I'm noticing that only payment notifications are being forwarded to the notification URL override, while users that cancel their subscriptions in their paypal accounts are still having the IPNs forwarded to the original xenforo notification URL.
 

Chris D

XenForo developer
Staff member
I’m not sure but we don’t process cancellations in the software anyway.

The subscription gets cancelled on the XF side when a subsequent payment isn’t received by the expiry date (shortly after the expiry date to be precise).
 
Top