#crehbichler-default_payment_method
1 messages ยท Page 1 of 1 (latest)
๐ Is there a reason you need to create the Subscription before collecting the PaymentMethod? You can set Customer.invoice_settings.default_payment_method at any point and you'll want to do it manually, but if you set it first and then create the Subscription with off_session: true, it'll just pay the first invoice automatically.
https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
https://stripe.com/docs/api/subscriptions/create#create_subscription-off_session
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 but creating the subscription before collecting the payment method is the documented/correct flow @ancient rose
but it has this annoying edge case that the default_payment_method doesn't get set automatically and you have to do it in a webhook, as far as I know though that is the only option for now ๐ฆ
Yep, if you want to follow that flow, you would just set the default payment method manually.
Thank you! I was also thinking to go the other way around. So, before creating the subscription, attaching the pm to the customer + set it as default (both within our backend).
But then I had the problem that the card is already there, even when the 3D secure flow fails afterwards.
Was thinking about relying on invoice.payment_failed, but didn't continue there....
So I might keep following the documented flow and rely on invoice.payment_succeeded event, until there is a better way to handle it
But then I had the problem that the card is already there, even when the 3D secure flow fails afterwards.
You can do the 3DS flow and then only if it succeeds, set the card to the Customer's default.