#robertpartfy
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
What I'm trying to achieve here is: I have a Subscription which requires a renewal, and the Customer doesn't have a valid PaymentMethod (insufficient balance, etc.). I send a link to the customer so they can enter a new PaymentMethod and complete the Subscription renewal.
The PaymentMethod is then used to pay the Subscription renewal via Stripe JS' confirmCardPayment
However, I cannot attach the entered PaymentMethod to the Customer in question
How can I do it?
Stripe can handle this automatically, you can go to Dashboard: https://dashboard.stripe.com/settings/billing/automatic
There, you will see the Manage failed payments section.
Otherwise, if you want to do it manually, it's best to use SetupIntent, and follow this guide: https://stripe.com/docs/payments/save-and-reuse
But I already have a PaymentIntent
The one from the Invoice that was generated on the Subscription renewal
Have you tried handling it automatically?
I need to handle it manually
I see
Let me check this on my side
Then you can use the SetupIntent to attach a new payment method to the customer. And then try paying the invoice again on your backend: https://stripe.com/docs/api/invoices/pay
Ok, will try it out!
You can also send the hosted_invoice_url to the customer, and then the payment method they used will be set as default:
https://stripe.com/docs/api/invoices/object#invoice_object-hosted_invoice_url