#davethecust

1 messages · Page 1 of 1 (latest)

supple elmBOT
simple wren
#

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

bleak sonnet
#

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?"
simple wren
#

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

bleak sonnet
#

np np i am happy to provide a customer id if you need more example

#

yeah exactly

simple wren
#

Do you use webhooks?

bleak sonnet
#

yes

simple wren
#

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

bleak sonnet
#

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

simple wren
#

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.