#peter_api
1 messages · Page 1 of 1 (latest)
đź‘‹ Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đź”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1399468479874076833
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
I don't believe there's a way to specify the order for how the saved payment methods show up on the Checkout Page, let me double check just to be certain
Ok, thanks @tropic ferry . Seems like I can neither define the preferred default generally nor specify it during a specific checkout creation — it appears to just select the most recent
(Common ecommerce experience of someone specifying their primary card when they save multiple)
I understand. It's just not something Hosted Checkout Page does today. We have this callout in our doc - https://docs.stripe.com/payments/existing-customers?platform=web&ui=stripe-hosted#display-additional-saved-payment-methods:~:text=If your Customer has multiple saved cards%2C Checkout prefills details from the card matching the following prioritisation%3A
If your Customer has multiple saved cards, Checkout prefills details from the card matching the following prioritisation:
- In
paymentmode, Stripe prefills the fields using the Customer’s newest saved card.- In
subscriptionmode, Stripe prefills the Customer’s default payment method if it’s a card. Otherwise, Stripe prefills the newest saved card.
Oh interesting, I was testing in payment mode, thx for mentioning this clarification
NP! 🙂
Another detail on setting default_payment_method on a customer, I’m not 100% sure what this means:
All future invoices for this customer will now charge the new PaymentMethod created with the setup mode Checkout Session.
Ah that'd be under invoice_settings
Does that mean all other current active subscriptions will get their default payment method updated? Or just new ones?
https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method
I don't believe it updates the existing Subscriptions' associated payment methods but you can quickly give it a try in test mode to double check
You can also set a default_payment_method directly on the Subscription
In case existing Subscription payment method does get updated with default payment method changing
Ok yeah, sorry, just tested -- appears to not update them
r = stripe.Subscription.list(customer=dj_cus.id, stripe_account=dj_cus.stripe_account)
for s in r.data:
print(s.id, s.default_payment_method)
# sub_1RlETtEOSccnAPUemVsg8w6u pm_1RlETsEOSccnAPUeor3uWYNP
# sub_1RkrsXEOSccnAPUecDhuSuuy pm_1RkrsUEOSccnAPUecua94VeQ
# sub_1RQBBVEOSccnAPUe5XXx5u26 pm_1RQBBVEOSccnAPUeDDDulxIL
a bit ambiguous in the docs, but yes testing is always the best way to answer!
one last related question—if I want to add an “add payment method” UI, purely for someone to save a card for later. Two assumptions:
- I should only use
allow_redisplay="always"payment methods in a save-for-later context - Instead of creating a checkout with
saved_payment_method_options={ "payment_method_save": "enabled" }, I would instead want a way to create a payment method that forcesallow_redisplay="always"
I don’t think the hosted checkout supports this? Is that true? And if so, would I need to do something in Stripe elements and call the underlying APIs more directly?
allow_redisplay just controls if the saved payment method shows up on a subsequent Checkout Session when the customer attempts another Checkout. So if you want "any and all" saved payment methods to show up as saved payment methods on Checkout then you'd force it to always
saved_payment_method_options is for you to choose if you want to allow saving the payment method in the first place
Alternatively, if you want to just save a payment method without charging it then you can create a Checkout Session with setup mode - https://docs.stripe.com/payments/checkout/save-and-reuse
Oh… I can work with setup_intent.payment_method and even update the payment method allow_redisplay if necessary (https://docs.stripe.com/api/payment_methods/update?api-version=2025-06-30.basil#update_payment_method-allow_redisplay)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yup