#aero
1 messages · Page 1 of 1 (latest)
hello! you can listen for the invoice.upcoming event - https://stripe.com/docs/billing/subscriptions/webhooks#events
i'm not entirely sure what you mean by
Do I need to explicitly cancel the whole subscription as well once one of the payments/invoices gets cancelled?
It really depends on your business needs and the context, maybe you can illustrate this with an example so that i can better understand?
yeah I'm imagining a user's subscription is renewing, and I'd check if X is back in stock before allowing the payment to come through.
In my particular use case, once something is out of stock, it's uncommon for it to come back in stock (or at least anytime soon), and I'd like for there to not be any more attempted invoices in the future
Is there any events I can listen to on attempted renewal (rather than an upcoming one)?
I guess there isn't a way to return false or something when a subscription is attempted to be renewed. Moreso, these are events I can listen to where I would then determine my next action
to clarify, you want to know what event to listen for when the payment for the invoice happens?
yeah my understanding is there's some delay for when an invoice is created until when it is paid & finalized.
Is this a reasonable window for my application to intercept and cancel an invoice?
ah yes, ~1 hour
ignoring the first invoice, subsequent invoices when created, will take ~1 hour to be finalized
is there ever a chance it would finalize significantly faster than that (such that my application wouldn't have responded in time)?
perfect
thank you!
so I would listen to invoice.created, and then there exists some API where I can cancel the invoice?
- I can additionally cancel the whole subscription if I so desire?
Are these the two actions I would take?
DELETE /v1/invoices/:id
DELETE v1/subscriptions/:id
so what you would do is to listen for the invoice.created event, then make any changes that you want to it. After ~1 hour, it would finalize and an invoice.finalized event will generate.
hmmm, iirc, you can't delete an invoice generated for a subscription, let me test it out
alright, so you cannot delete an invoice generated for a subscription. If you receive an invoice.created event (and before the invoice is finalized), what you can do is to just cancel the subscription. When the subscription is cancelled at this point, automatic collection for the invoice will be turned off, and that invoice will just remain in draft mode forever (and you can leave it as it is)