#trueinviso-invoice-retry-and-draft-finalization
1 messages · Page 1 of 1 (latest)
Can you share an example of the updates you're making here? And any unexpected payment?
You can always try calling the /pay invoice endpoint directly using the new payment method if you're contorlling the behaviour here.
There isn't anything unexpected, I used 0341 test card to add the $19.85 charge for a new product on an existing subscription. That charge failed as expected. Then I attached a new payment method 4242 that won't fail, and when it was added Stripe didn't try to charge the new card, it tried to charge the old card and still failed even tho the 4242 method is attached and set as default
0341 is the stripe test card number to attach a card that will fail when charged
Can you share the invoice/customer/PM id here? Did you update the customer invoice_settings[default_payment_method] after attaching it?
I"m creating a checkout session
cus_P5dM7WLluzKNe9
I deleted that new message, that doesn't apply here
Looks like you're using setup mode to collect a payment method, yes?
Then what do you do with that payment method?
It looks like you do update the customer here: https://dashboard.stripe.com/test/logs/req_cRifUldiWhdfQp
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
yeah, I listen on a webhook for payment intent updated then set their default payment method
payment_method_attached event
And are we referring to in_1OHX16HDRwNsRKsOdoGtd52H here or another invoice?
I'd suggest you call /pay for that invoice with the new PM in order to attempt payment with that once collected:
https://stripe.com/docs/api/invoices/pay
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
in_1OHX16HDRwNsRKsOdoGtd52H
Yes this one, but why would I need to tell stripe to charge it? Shouldn't stripe retry failed payment attempts automatically with the new payment method?
oh I see, this will trigger stripe to do that
but I still have to tell it what invoice to charge, ideally Stripe would just do it automatically, I guess it doesn't?
I would expect the next retry to use the new payment method, you can also detach the old one to be sure
but the `/pay call lets you trigger that now instead of waiting on that retry
You can verify behaviour is as you need here using billing test clocks to advance time to the next payment attempt, though
is there any easy way to find unpaid invoices to retry? then call it?
I'd recommend doing so:
https://stripe.com/docs/billing/testing/test-clocks
The behavior I want is for failing payments to be automaitcally charged with the new payment method so a user has access immediately
You can list open invoices with the List API: https://stripe.com/docs/api/invoices/list#list_invoices-status
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Is this also how I can avoid draft invoices?
I don't want these invoices to go into a draft state and wait an hour to retry because Stripe has already added the product to the users subscription plan. I want it to charge it immediately
it seems to happen when I create a new subscription schedule, the subscription schedule will add the new product and release, but the charge waits an hour to be tried
I guess I can just do the same thing when a users subscription updates, just look for open invoices and try to charge them
Yes, this is the default behaviour, you can read more about that here:
https://stripe.com/docs/invoicing/integration/workflow-transitions#finalized
You can advance this yourself explicitly using the /finalize endpoint, if you like
cool, thanks