#amarsbar2000
1 messages · Page 1 of 1 (latest)
Hi Vanya
Hi, let me help you with this.
Can I give some more context?
I understand what you're trying to do.
We have a subscription business. When our customers automatic payments fail. We send them a customer portal payment method update deep link. They click this link and update their payment method. But we get a lot of support tickets saying "I have updated my payment method but my subscription is still overdue"
Ok
You can listen to:
setup_intent.succeeded
payment_method.attached
Any would work.
However, you can also configure Stripe to send those emails automatically, and then you don't need to do anything else:
So if I listen to setup_intent.succeeded and fire some code on that webhook, how do I get the customers invoices, and retry any open invoices with the newest payment method?
I am using node
I'd imagine you'd use this endpoint: https://stripe.com/docs/api/invoices/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Passing customer and status parameters to get the open invoices
Right that makes sense
But how can I retry the invoice charge with the payment method that the cusdtomer has just added (they may have lots of other payment methods on their account)
You can use this endpoint: https://stripe.com/docs/api/invoices/pay
Pass the new pm_xxx from your setup_intent.succeeded event to the payment_method parameter
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
if I want to get all of the open invoices from an array of subscription ids, can I pass an array of subscription IDs to https://stripe.com/docs/api/invoices/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Also, can you pay multiple invoices at once with
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
No, you'd make multiple requests passing a single sub_xxx to the subscription parameter
No, one per request
We don't really have any batch endpoints
Ok thanks for your help.