#xxxxxxxxxxxx_api
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1315656770605027409
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- xxxxxxxxxxxx_api, 3 days ago, 11 messages
Hello,
As I said in the other thread, I’m experiencing an issue upgrading users from monthly to yearly subscriptions in Stripe.
Problem:
• Users upgrade by replacing the monthly plan with the yearly one, generating an invoice.
• If the payment fails (e.g., due to 3D Secure), the subscription is already updated to yearly, so users get access without paying.
• Reverting to monthly generates another invoice due to the billing interval change, possibly charging users again.
To fix this, I created a one time coupon of 100% to make the invoice to 0. But now the problem is that even if the invoice is set to 0, the billing cycle is set to today and not the "real" subscription billing cycle.
I tried to update the sub again with the old billing cycle but I saw that you cannot make it to the past.
Do you want the upgrade to happen immediately or after the current cycle ends?
I want it to go back at the state before failing the payment
- monthly paid 2 december
- changing monthly to yearly 3 december
- payment fail, we revert to monthly
- when reverting, since we changed the billing cycle (yearly to monthly), it generates invoice
- we make invoice to 0 dollar with a 100% coupon
- we have now next invoice that will be 3 january instead of 2 january
And the last bullet point is the problem
Have you tried using payment_behavior=error_if_incomplete? https://docs.stripe.com/api/subscriptions/update#update_subscription-payment_behavior
No i didn't but I don't really understand it. I used pending_if_incomplete but it doesn't work when changing billing cycle (from monthly to yearly)
What will happen with error_if_incomplete ? Will it works ? Your collegue said that the best way to handle this edge case is by reverting sub with 100% off coupon.
What I think will happen that it will fail without making any changes to the Subscription if the new Invoice payment fails.
Yes we won't apply the update (to the yearly plan) if the requirement payment fails
Well as I thought it is not what I want. When user has 3DSecure, it just fails the payment
Well yes, that's expected. But you can rescue that scenario and handle the auth with the customer:
Payments often fail because the payment method is declined or because they require customer authentication. You should build logic to handle both of these scenarios.
Use the instructions for payment failures to handle card declines. You need to attach a new payment method to the customer and then use the pay endpoint to pay the invoice that the update generates.
Use the customer action instructions to handle customer authentication. This walks the user through the authentication process and then pays the invoice.
https://docs.stripe.com/billing/subscriptions/pending-updates#handling-failed-payments
The update is still 'pending' for a period of time and a successful payment will apply it