Not a bug No way to cancel subscription when Stripe payment fails

PaulB

Well-known member
Affected version
2.2.8
If a user has a subscription that has lapsed because payment failed, but Stripe is still attempting to charge them, they have no way to cancel it, since XenForo shows that they don’t have an active upgrade. Stripe will keep attempting to charge them until it gives up, and there’s nothing the user can do to stop it.
 

Chris D

XenForo developer
Staff member
This is correct. But you‘re able to and should cancel it on their behalf from your Stripe dashboard. Not really a bug but there may be a suggestion you can add your support to.
 

K a M a L

Active member
This is correct. But you‘re able to and should cancel it on their behalf from your Stripe dashboard. Not really a bug but there may be a suggestion you can add your support to.
I wanted to report the same issue before but thought the current behavior may be good, but in some circumstances this may be considered a bug .. I had an issue with a customer where stripe tried to charge the recurring subscription with no luck .. after grace period xenforo downgraded the user , when the user got some money on his card and went to subscribe again .. he was charged for the cancelled subscription as well resulting in a double charge.
 

PaulB

Well-known member
wanted to report the same issue before but thought the current behavior may be good
The recharging behavior is good, but a user should be able to stop it from trying to recharge. Currently, once the subscription has expired, Stripe will keep charging, but there's no way for the user to stop it.

after grace period xenforo downgraded the user
I don't think XenForo has a grace period. Stripe typically charges the user before their subscription actually expires in case there's an issue.

he was charged for the cancelled subscription as well resulting in a double charge.
Right, that's the sort of issue that arises. I believe XenForo will try to credit the user for both charges, but it's still unexpected, and both subscriptions will continue indefinitely.

But you‘re able to and should cancel it on their behalf from your Stripe dashboard.
Depending on the country, what sometimes happens is the charges fail because users don't have enough funds in whatever account they were using. In a panic, they contact us to try to get automatic charges to stop, but there's often no reasonable way we can respond before the next attempted charge. That's really not a great situation, especially if it's happening outside the work hours of both our company and the user's bank.

This isn't really a problem in the US since people typically subscribe with credit cards, so we can simply refund them. For someone in India, though, this scenario can cause pretty significant problems.
 

K a M a L

Active member
I don't think XenForo has a grace period. Stripe typically charges the user before their subscription actually expires in case there's an issue.
Xenforo has 24 hours grace period before downgrading the user after failed charge
PHP:
// For recurring payments give a 24 hour grace period
if ($active->end_date + 86400 >= \XF::$time)
{
   continue;
}
 

alexm

Active member
Xenforo has 24 hours grace period before downgrading the user after failed charge
PHP:
// For recurring payments give a 24 hour grace period
if ($active->end_date + 86400 >= \XF::$time)
{
   continue;
}
Yes, I have a user who does that every month. He gets 1 month + 1 day free and then rejoins again, every month. People! :rolleyes:😄
 

Jake B.

Well-known member
I can't imagine how this isn't a bug. The software creates the subscription with a first party integration with Stripe, Stripe's subscriptions behave by automatically retrying the payment if it fails. If the subscription is being cancelled internally by the software I can't imagine any situation where the desired behavior wouldn't be to also cancel the subscription through Stripe so someone doesn't get charged indefinitely for something they are no longer receiving the benefits of.

Setting Stripe to not retry on failed payments can be done at Settings -> Subscriptions and emails -> Manage failed payments, but this will apply for your entire account so if you use another software as well which correctly handles these payments it will break there
 

ichpen

Well-known member
I think the only reason this isn't a bug is that it's a major gap in XF not managing the lifecycle of a subscription with Stripe that it creates. It's definitely a a much needed feature.
 

PaulB

Well-known member
It appears that when this situation arises, the user is able to purchase the upgrade again from XF. That would likely create a second subscription on Stripe's end, and if Stripe's attempts to charge for the original subscription eventually succeed, the user will have two Stripe subscriptions for a single XF subscription. That would result in double-charges. I believe XF would extend their subscription based on how much they're paying, but that's still undesirable, and I haven't actually tested this.
 

oO5 Dynasty

Well-known member
I have not set up Stripe yet, but I plan to. Is this something I should be worried about? I currently only have Paypal set up, and I would hate to run into these money issues when I start my subscriptions.
 

PaulB

Well-known member
I think it’s worth worrying about and consider it a significant bug. Others may disagree. You’ll have to decide how it impacts your use case.
 

PaulB

Well-known member
I just saw this issue arise with a PayPal subscription, so it's not limited to Stripe. cc @oO5 Dynasty

Here's the timeline:
  • May 26: PayPal attempts to charge user for a subscription renewal, but fails. PayPal gives XenForo a retry_at date of May 31.
  • May 26: Upgrade expires in XenForo.
  • May 30: User notices subscription has expired. They fix their PayPal account and purchase the upgrade again in XenForo.
  • May 31: PayPal retries charging for the original subscription. It succeeds. User has now has two active PayPal subscriptions for the same upgrade.
This is a little different from Stripe in that the user is technically still able to cancel the subscription from their PayPal account. However, XenForo shows no indication that there's an active subscription and gives them the ability to upgrade again, which starts a concurrent PayPal subscription.
 
Top