#luke_webhooks
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/1309087137987170325
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
๐ happy to help
Here's the sequence of events.
- User's subscription was cancelled due to failed payments
- User added a new payment method
- User gets charged
I would have expected a new subscription to be created but it hasn't. How are we meant to handle this?
yes this is basically related to your dashboard settings
you marked the invoice as uncollectible instead of voiding the invoice
Oh ok. Is that in revenue recovery?
please give me a second I'm double checking something
Ok
If it helps my webhook is here: https://github.com/lukevella/rallly/blob/main/apps/web/src/pages/api/stripe/webhook.ts
Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier. - lukevella/rallly
this is not technically related to your webhooks
ok so let me explain what happened here
based on your settings, if the payment fails past all retries the subscription will be canceled and the invoice will be marked as uncollectible.
Uncollectible is a payable state though, so your customer would still be able to pay the invoice at that stage even if the subscription is canceled
https://docs.stripe.com/invoicing/overview#invoice-statuses
you have 2 options here and depending on your business model you can choose either one
the first option: once you receive customer.subscription.deleted event you can void all non-paid invoices of that subscription, which avoids you dealing with this situation again
the second option: you don't change the current behavior, but when you receive a invoice.paid event on a subscription that is already deleted you can create a new subscription and backdate the start_date to the period start of the invoice
as for the payment part, you can either credit the customer balance to pay the newly generated invoice or you can add discount or trial period
Would it be easier if I leave invoices as past-due rather than marking them as uncollectible?
same issue if the subscription is cancelled
Ok so maybe I can leave the subscription as past-due as well?
yes that's a 3rd option
but this means you want to handle the service fulfillment on your end (when to pause/stop and when to reactivate)
in all cases there are cases that you should take into conisderation in your webhooks that you haven't accounted for yet
Ok I think I understand. In the first option, if I void all unpaid invoices, the user would be creating a new subscription after updating their payment method then?
will I receive a checkout.session.completed because that's what I'm expecting to set the subscription id for the user
the user would be creating a new subscription after updating their payment method then?
the subscription won't exist anymore and the invoice won't be "payable" anymore
Right so they have to go through checkout again. Would they then be treated as a new customer?
will I receive a checkout.session.completed because that's what I'm expecting to set the subscription id for the user
if they create a new subscription using your Checkout Sessions flow then yes
but in all cases I advise you to use invoice.paid instead of checkout.session.completed
for everything related to your service providing/fulfillment
Ok interesting. I'm not sure how to get the userId from that I cause right now I pass it in the checkout metadata or the subscription metadata. I guess I can get the subscription from the invoice?
Have a call right now so might be slow to respond but thanks for your help!
I guess I can get the subscription from the invoice?
correct