#davethecust
1 messages · Page 1 of 1 (latest)
Hi there! You can set some rules for retries in your Dashboard: https://dashboard.stripe.com/settings/billing/automatic
If all retries are exhausted, the invoice can be marked as uncollectible or left as is. There are also settings for how to handle subscriptions after all retries are exhausted
thanks i am asking about how to do it through the api, sorry i should've been more specific. the current scenario i've ran into a few times is:
- user creates subscription with 7 day free trial
- payment fails due to credit card failing for some reason or another
- user goes to billing portal and cancels subscription
- payment continues to be retried
- user emails me saying "why are you still trying to charge me i canceled weeks ago?"
ah i see, thanks for the additional context
I assume the payment that is retried is from a previously-finalized invoice that is still associated with the now-canceled subscription
Do you use webhooks?
yes
Got it. You could listen for customer.subscription.deleted events, retrieve the latest invoice, and determine how to handle it
It's up to you to determine whether the customer should still pay that invoice or if it's safe to void it or mark it as uncollectible
got it
so to summarize it seems there are 3 possible ways to accomplish this, in all cases i have access via webhooks to the invoice object associated with the subscription object:
- fetch payment intent from invoice, then cancel it (my initial attempt at a solution)
- void the invoice
- mark invoice as uncollectible
in all 3 of the above cases the invoice should stop getting collected right? or is there a trade off that makes one better than the other
That's right. For record keeping purposes, it's best to work with the invoice object instead. If you know the invoice will never be paid, updating the invoice status would be the more accurate way of accounting for this.
Details on the void and uncollectible statuses are available here: https://stripe.com/docs/invoicing/overview#invoice-statuses