#peter_api

1 messages · Page 1 of 1 (latest)

mint creekBOT
#

đź‘‹ 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.

tropic ferry
#

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

tranquil vale
#

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)

tropic ferry
#

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 payment mode, Stripe prefills the fields using the Customer’s newest saved card.
  • In subscription mode, Stripe prefills the Customer’s default payment method if it’s a card. Otherwise, Stripe prefills the newest saved card.
tranquil vale
#

Oh interesting, I was testing in payment mode, thx for mentioning this clarification

tropic ferry
#

NP! 🙂

tranquil vale
#

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.

tropic ferry
#

Ah that'd be under invoice_settings

tranquil vale
#

Does that mean all other current active subscriptions will get their default payment method updated? Or just new ones?

tropic ferry
#

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

tranquil vale
#

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:

  1. I should only use allow_redisplay="always" payment methods in a save-for-later context
  2. 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 forces allow_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?

tropic ferry
#

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

tranquil vale
tropic ferry
#

Yup

tranquil vale
#

Got it, thx!

#

thx for your help @tropic ferry 🎉