Is it possible to know the state of a Paypal payment profile?

lasertits

Active member
I'm tinkering with the account upgrades on my XF install, and one of the things that came to my attention was the fact that if a payment fails for a subscription / upgrade, Paypal sets their payment profile ID to SUSPENDED and then it's up to me to take action in order to either cancel the sub or collect the funds. I presume if I cancel the sub XF will then downgrade the user and all is peachy.

However, given I don't cancel their sub and I wish to collect the owed funds, during the time they're in a SUSPENDED state due to a failed payment, they still have an active upgrade on XF, and thus in my case they still have powers elsewhere associated with being in the group that the XF upgrade granted.

What I'm curious to know, is if it's possible for XF to know the state of a paypal payment profile, whether it's ACTIVE, SUSPENDED, or CANCELED, and then run a function in regard to that state?

Basically what I'd have it do is if the profile was SUSPENDED, XF would append a "Disabled" group to the user for the time being. Once the payment profile was set to active again, it would remove the Disabled group and their permissions would no longer be overridden.

This idea came to mind because I had a user who signed up for a subscription / upgrade 3 days ago, and his payment apparently went through / completed, and thus he was upgraded, but now today Paypal says his payment failed and I never got the $, yet on XF he's still upgraded and set to expire/renew a month from now. In most cases leaving them upgraded and then attempting to collect the owed funds works fine, but since my upgrades are associated with perks/powers on game-servers, having them disabled gives the gamers incentive to check their email or the website and ensure the payment is completed so they aren't canceled / downgraded. Most users will just go to the site in order to get their powers in-game and don't visit again frequently. In this particular case, if I didn't catch his failed payment he would have had a free account upgrade / Server Admin for a month without paying a dime.

I've actually contacted paypal in regard to the above to find out more information on how a payment can be completed initially and then all of the sudden 3 days later apparently fail and I never get the $, so perhaps their response will shed some light on this and the behavior I'm seeking won't be needed, but I doubt it. Also not accepting echecks via paypal as I know those have the same behavior as the above, paypal sees it as being completed but the echeck doesn't actually clear. So what the case is in this particular instance is beyond me.

eidt: Apparently it was just a bank reversal after the fact, so when paypal realized i got $0, it suspended the profile and that's all.

I suppose any insight on how account upgrades communicate with paypal and back, via the IPN / payment callback could be helpful. I do think the Disabled idea in my case would be quite useful / helpful in cases such as this, which from my experience with paypal are common, it's only recently that XenForo has been thrown into the mix.

Thanks.
 
Top Bottom