Expiring recurring user upgrade should explicitly cancel with payment provider and not assume failure

Xon

Well-known member
Affected version
2.2.13
XenForo actively expires user upgrades which haven't been extended by the payment handlers. This design originates from paypal IPN and the older paypal API which makes cancelling subscriptions via that API "challenging".

However, stripe behaves differently. Some times a retry occurs and the documented events for the stripe webhook are not sufficient to cover this situation.

I've had a case where a user had a recurring subscription with Stripe failed to charge the credit card, and XenForo timed out the user upgrade. The user then re-subscribed. However; Stripe successfully charged the card 7 days later and informed XenForo.

It looks like XF\Repository\UserUpgrade::downgradeExpiredUpgrades which calls \XF\Service\User\Downgrade::downgrade doesn't attempt to call the payment handler to cancel any pending charges which XenForo thinks has failed but may still be retried later.
 
I checked the Stripe event log for the payment attempt; It failed on the 9th (invoice.payment_failed event), and then magically was tried again on the 17th and worked (charge.succeeded)
 
Back
Top Bottom