#dick-flair_best-practices
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/1369246958195314758
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
So I am integrating stripe with our web portal, it's already integrated and we use it for checkout, updating subscription etc. and I don't know if you'll be able to help with best practice with this but basically, I've created a new toggle on our database for "account expired" and the idea is that, once a subscription has hit 7 days after the subscription was meant to renew, I want to update the database on our end (via webhooks maybe?) to set this toggle in the DB to true. There doesn't seem to be a subscription overdued webhook event so would I have to use the invoice.overdue event? and if so, can I detect this 7 days after it means to be paid for?
When I was testing this with the simulation, I had a monthly subscription, I removed the payment method on the customer, and used the simulation to advance the month, and it kept the invoice as failed payment or something along those lines (sorry, thought I had an example for this but turns out I might have deleted it)
are you using send_invoice or charge_automatically as the collection_method
ok so it seems you're using charge_automatically
Yep, that's right. I found the invoice example I was testing
https://dashboard.stripe.com/test/invoices/in_1RJYc8BfyqrFMGFSV6QuTjIr
So that invoice was for a customer I had removed the payment method for. After the initial payment faield due to no payment methods, it tried it again (3 times I think - as per setting) and I was expecting it to appear as overdued so that it would send a webhook event but it remained at failed so the webhook event never fired. Which what prompted help to come here to see if there's a better way to handle this
did you set in your settings the failed behavoir to change the status to overdue?
you're actually cancelling the subscription though
so you can then listen to customer.subscription.deleted
hi! I'm taking over this thread. let me know if you have other questions.
Thanks tarzan, just having a look through, 2 mins
Hi Soma, will do, just trying something out
I've changed the setting to set subscription to overdue, the invoice made the 3 retries, but still has left the invoice at failed
https://dashboard.stripe.com/test/customers/cus_SGEjecLWXBuBzw
But now the subscription is overdued, but there's no event for overdued subscription that I can listen to?
I could revert back to cancel subscription if all payment retries have failed and use customer.subscription.deleted but how would I differentiate with just users cancelling their subscription as normal as opposed to subscriptions where the subscription was cancelled due to the failed payments or not paying at all?
you can check this to know why the subscription was cancelled: https://docs.stripe.com/api/subscriptions/object#subscription_object-cancellation_details-reason