#dan-d_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1293288985317081101
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- dan-d_api, 6 days ago, 18 messages
My thought was to setup a webhook to monitor payment intent failures and if the payment intent fails and the payment method was of a certain type. Cancel the payment intent and then create a new one with the other payment method I want to use.
But that seems wrong because Stripe best practice says the payment intent track the lifecycle of all payment attempts.
Hello sorry for the delay here
Things are running a bit busy today
Not a problem!
I don't think you can cancel a PaymentIntent associated with an invoice. If you do, that might void the invoice..
You can reattempt the same PaymentIntent with a different PaymentMethod
I see you responding to multiple threads at once lol
Alright dumb question. How do i reattempt a payment intent?
I know how to update a payment intent's payment method.
I know that there is some automatic retry built in. Is there any other way to manually retry?
You can use the Pay an invoice API and pass existing payment method ID to payment_method param - https://docs.stripe.com/api/invoices/pay
if I use that API and specify a new payment method does that function the same way as if i were to update the payment method on the payment intent?
Meaning it gets updated for all subsequent attempts?
Not exactly. if the invoice was generated by a subscription then you'd need to update the default payment method on either the subscription or the customer's billing settings
https://docs.stripe.com/api/subscriptions/update#update_subscription-default_payment_method
https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hmm the invoice is generated via the create and finalize invoice API Flow. I am not using subscriptions
Our own internal subscription models is the thing generating these invoices
Gotcha. So you can just update the default payment method of the customer under invoice_settings
The next invoice you create with collection_method: charge_automatically should attempt to charge the new/updated payment method
Alright so to give some more context each customer has an ACH and a card payment method. And for some invoices we would like to attempt the ACH first (bigger, recurring invoices) and some we just want to never attempt the ach and use the card always.
And because of this there could be multiple invoices in multiple states ie:
one is trying on ach and one is trying on the card.
Is it possible to avoid changing the default payment method under the account to do this because it could affect other invoices?
Is the best way to do this is to default the payment method on the account to the card? And then for ach attempts specify that on the payment intent? And if it fails just update the payment intent's payment method to the card or default it? Is this at all possible to do?
You can always specify which payment method you want to charge when you create the invoice - https://docs.stripe.com/api/invoices/create#create_invoice-default_payment_method