#thomas_subscription_recovery
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. Thank you for your patience!
โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.
๐ 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/1212878300209483817
๐ Have more to share? You can add more detail below, including code, screenshots, videos, etc.
Hi there! By "udpate their card in their dashboard", are you referring to the Customer Portal or something else?
Hi,
I do not use the Customer Portal from Stripe, it is homemade using the API, but the result is the same. I correctly receive the new payement method for that user in my stripe dashboard
Here is a client in this case : cus_LlHQxVOL4iWes4
Payment error on the 28 at 14:26 and card update on the 29 at 15h49
Gotcha, okay. While I look at this customer, do you know how you currently handle subscriptions with regard to recovery? https://docs.stripe.com/billing/subscriptions/overview#settings
Ah, I see. You're creating a Checkout Session in setup mode to collect new card details from the customer.
Yes, subscription is set as past_due, but I cut the customer access to my website in this case
And it will be automatically restored if a new payement suceed
Thats it
You could either wait for your retry settings to automatically retry the payment or you could make a call to manually pay an invoice: https://docs.stripe.com/api/invoices/pay
I see you're already setting the new PM as both the customer's default for invoices and setting it as the default on the subscription directly
Yes, I would like to manually make a call to pay the invoice, as the customer is expected to have his acess to the website back after he updated his credit card
So making a call to /pay the invoice should trigger a payment attempt using the newly-collected PM
Ok thank you. What is the best way to get the id of the unpaid invoice for that customer ?
You'll likely have already stored the ID of the Subscription's latest invoice (from webhooks) so you can make a call to pay that Invoice, which should move the Subscription to active
If you need to retrieve it on the fly, you can make a call to retrieve the Subscription and look at latest_invoice: https://docs.stripe.com/api/subscriptions/object#subscription_object-latest_invoice
Ok perfect, I think I will manage it from here, thank you very much ๐
I see you're listening for invoice.payment_failed events so you can retrieve it from there, or from the customer.subscription.updated event
Sure thing!
Even better, thanks ๐
subscription_recovery