#JontyBehr
1 messages · Page 1 of 1 (latest)
Can you share the sub_xxx ID?
@simple sedge - here is the customer: cus_MnFpju64YyWYLF.
First subscription is sub_1M3fJnGCgNDU122LjgrTbAgD (this one is Active)
Second subscription is sub_1M3gjMGCgNDU122LY5GcHSpg (this one is Incomplete)
Yep, the initial invoices (https://dashboard.stripe.com/test/invoices/in_1M3gjMGCgNDU122LBiQ8IzhA) requires payment. But there's no PM to facilitate that as:
- No
default_payment_methodwas passed on creation. - The associated Customer object does not have a default PM set.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Is this the actual problem and, if so, what is the best way to handle it? I can't see a way via the api to set a default payment method?; OR
You can set a default at subscription level: https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method
or on the Customer object: https://stripe.com/docs/api/customers/object#customer_object-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.
The Subscription default_payment_method takes precedence in instances where both are set
In this particular scenario (sub_1M3gjMGCgNDU122LY5GcHSpg) you'd need to return the PI from invoice and confirm it in the front-end with Stripe.js: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#complete-payment
So, for the second subscription, what do I actually need to show to the customer before they enable their second subs?
Do I need to actually show them the payment element again?
For that specific subscription you'd need to confirm the PI with Stripe.js yes. Whether you need to collect payment details from the customer would depend on whether they have saved PMs
OK, but in this case we do have a saved PM
Is it not possible to just set the default payment method on the customer when they enable their first subscription?
And then that will automatically get used when they enable their second subs
i.e. you could show a list of saved PMs for them to select, and then pass that pm_xxx ID to Stripe.js to confirm: https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-existing
(without me having to show a payment element to them for the second subs)
Yes, via an additional API call (we don't do that automatically)
Is that not the most optimal way to handle it?
Because then its set as their default, so if they enable multiple subs, it will just always be used
(and this is how it used to work pre payment intents)
you can use customer.invoice_settings.default_payment_method sure, whatever works for you
When you say " you can use" - what do you mean by that exactly?
Do you mean I can set that PM as the default, and it will be used automatically for the next subscription?
yes
the way it works is
an invoice needs to be paid. We look at the following in order to find the payment method to charge
- subscription.default_payment_method
- subscription.default_source
- customer.default_payment_method
- customer.default_source
so I think that's clear and I'm understanding your question?
Yeah, so after the first subscription, I can just set the PM as the customer.default_payment_method, right?
Or is it customer.invoice_settings.default_payment_method?
the latter