#Carlos-subscription
1 messages · Page 1 of 1 (latest)
Hi! You have two options:
- Update the
default_payment_methodof the subscription: https://stripe.com/docs/api/subscriptions/update#update_subscription-default_payment_method - Or update the
invoice_settings.default_payment_methodof the customer https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
But how do you know when to change?
How can I detect that there was a difference in the payment method and change it?
generally you would know it's changed since you had some API calls to collect and set the method, so I don't quite follow. But there is for example a payment_method.attached event so maybe that is useful https://stripe.com/docs/api/events/types#event_types-payment_method.attached
I will try to explain my situation better.
My subscription model:
1st step: Create the customer without payment data
Step 2: Create the signature
3rd step: I collect the payment data and validate it with confirmCardPayment
Then I monitor the subscription_create event and set the payment method as default.
I'm having difficulty just with the subscription_cycle event, how to detect that there was a credit card change and set this new medium as default?
In a new subscription cycle, if stripe is unable to charge the old credit card, I use confirmCardPayment to collect a new payment method