#Jeffrey-checkout-subscription
1 messages ยท Page 1 of 1 (latest)
Hi there ๐ when their mode is set to subscription the Checkout Session will attach the provided payment method as the default_payment_method for the Subscription that is created, but will not set it as the default payment method for the Customer.
https://stripe.com/docs/api/subscriptions/create#create_subscription-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.
Is there a way to make it the default payment methode for the customer?
We are needing this because we have a process where a cancel a usage subscription and create a new sub "normal" subscription but are getting the error that the user don't have a default payment method
There is not a setting to make that automatically, but you can build a process which handles it. You can use a webhook endpoint to listen for checkout.session.completed events, and then have your event handling code make a request to update the invoice_settings.default_payment_method field for your Customer:
https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
I just checked the output but I cannot find default_payment_method in there, in the checkout.session.completed hook I can see the default_payment_method I will try this format should be "pm_" correct?
Hello ๐
Taking over as toby needs to step away
Yes the payment method object ID would start with pm_xxxx
Hey, thank you
I just read the docu from update a customer I dont really understand what is the different between default_source and default_payment_method?
default_source is a parameter that was used for the old Sources API
PaymentMethod API was introduced to replace Sources API
https://stripe.com/docs/payments/payment-methods/transitioning
default_payment_method would refer to a PaymentMethod object
OK so the new good way is using default_payment_method and not longer default_source if I understand that correct?
That's correct.
that worked thank you
we can close this thread ๐