#OI-subscription
1 messages · Page 1 of 1 (latest)
the generated invoice sits in draft state.
The invoice is in draft for a couple hours by default, it gets finalized automatically afterwards. It's just to allow you to modify the invoice, for example if you want to add extra items to it async each month
In this particular case, the invoice sat in draft state for more than a day
but my particular question is: what happens in the case where a customer has no payment method associated and the invoice is set to automatically collect from the default payment method? I've gone through the docs but sadly couldn't find this case depicted anywhere.
btw thanks for the prompt response!
In this particular case, the invoice sat in draft state for more than a day
It likely is unrelated to the trial or no payment method though, usually it's because your webhook endpoint didn't respond to theinvoice.createdevent
the invoice is set to automatically collect from the default payment method
We attempt to pay, but there's no card so payment fails, same as if the card was declined for insufficient funds
oh you know what i do have a pending webhook to an endpoint that still is not setup, would that cause invoice to still be sitting on draft?
yes! basically we wait for you to add items to your invoice. If we didn't wait for you to ack the invoice.created and just closed, imagine if you have a bug and are down for 3 hours, all those invoices would charge the wrong amount (assuming you wanted to add items) so we wait for you to respond to those events (up to a maximum of 3 days)
ah that makes more sense...because i tried to repro manually (customer w/o payment method, and ending trial manually) but faced a 400 from stripe saying "no available payment method found.." so i was worried it was some sort of eternal loop
yeah it's because when you end the trial we try to pay synchronously
which is different from async failure. You can trial with a trial_end set to a few minutes in the future
and you can call https://stripe.com/docs/api/invoices/finalize to force finalization and then see what happens
so just to recap:
If a customer with no payment method associated, has a subscription with a trial period, when it ends, and invoice actually tries to get billed, having on payment method available is the same as, say, declining a card or something like that, resulting in a failed payment right? That would make the Smart Retries logic kick in?
that sounds good, will certainly try that. Although your initial suggestion about invoice sitting in draft because of webhook is on point. My production site is still not set up to receive said webhooks so naturally it was returning 100% error rate, thus pending webhooks, so now i've disabled it.
and yes it works exactly like you say, but you have to collect the card details otherwise we'll retry with no cards
that's fine, but my question was whether the smart retry logic would still apply even though customer has no cards, as my intention is to react differently to this scenario (no cards) by shutting down subscription after first retry instead. I should handle that separately right? Or does Stripe offer some sort of way of distinguishing this
yes it will apply the same way
the easiest it to look at whether that customer has a card really. But you can listen for invoice.payment_failed and it would not have a charge id in charge
yeah i can set up a daily task that takes care of these cases in my BE. I'm using a library for Django (dj-stripe) which actually takes care of syncing stuff between stripe and the backend, so it listens for webhooks and stuff
I figured both cases would be considered equal by Stripe but just wanted to make sure I was correctly interpreting stuff.
Thanks koopajah!! you've given me a big hand
glad I could help unblock you 🙂