#ambi_code
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/1332282373215227979
๐ 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.
- ambi_best-practices, 2 days ago, 19 messages
Yes you likely just need to void any open invoices for that subscription on receipt of customer.subscription.deleted event
Actually the problem is that the subscription does not get canceled, but it stays in past_due until the retries are finished. So that's why i opted for this event, since it does not get canceled for a few days
I'd guess the portal is cancelling at period end, instead of immediately. Not related to the retries
You can configure that: https://docs.stripe.com/api/customer_portal/configurations/create#create_portal_configuration-features-subscription_cancel-mode
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Of course, sub_xxx ID example will help me confirm that
ok that's a great suggestion, thanks alot
here's an invoice and a subscription attached to it where this occoured: in_1Qi1JK2L54HYtpsWHULDYZ1t
Yeah the portal is configured to cancel at period end. So as you said, sub will stay in whatever state it currently has (past_due) until the end of the current period
But sub status is orthogonal to invoice retries โ we'll retry invoice payments even when the associated sub is cancelled. You need to void them manually, so my recommendation to you:
- Configure portal session to cancel immediately
- Listen for
customer.subscription.deletedevent - Find any open invoices for that sub via: https://docs.stripe.com/api/invoices/list#list_invoices-subscription
- Void them all
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Should get you the behaviour you want
No problem, glad I could help!