#salim-bt_api

1 messages · Page 1 of 1 (latest)

hot widgetBOT
#

👋 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/1389962124364873738

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

woeful nova
#

i use Express Checkout Element

median forum
#

Hi 👋 did you make a request to set that as the default payment method for the Customer?

Or are you talking about setting the default payment method for a Subscription?

It's hard to tell without more context

woeful nova
#

2nd

#

setting the default payment method for a Subscription

#

cus_Sbe2lXyPdpByfw

#

you can check

#

the card not marked as default

median forum
#

What is the ID of the Subscription? (that's more important if you want to set the default on the Subscription level)

woeful nova
#

sub_1RgQkdBZmGtUq60jSe8rd92a

median forum
#

default_payment_method is set there

median forum
woeful nova
woeful nova
median forum
#

If so, that won't show the default payment method for Subscriptions. It shows the default set at the Customer level, and that Customer doesn't have a default payment method set.

woeful nova
# woeful nova

now if i set this as default, the sub will use this card to renew?

median forum
#

The Subscription will use the default_payment_method that it has set, that takes priority over the default payment method set at the Customer level.

default_payment_method nullable string Expandable
ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over default_source. If neither are set, invoices will use the customer’s invoice_settings.default_payment_method or default_source.
https://docs.stripe.com/api/subscriptions/object?api-version=2025-06-30.basil#subscription_object-default_payment_method

woeful nova
#

hmmm and how change default card for Subscription level?

median forum
#

Update the default_payment_method field on the Subscription object

woeful nova
#

i thought changing default card of Customer level will change sub default card

median forum
#

Nope, not if you just update the Customer object, but I'm not sure if that's what you're talking about doing

woeful nova
#

these customer cards

#

if change default here, it will not effect default card of sub

median forum
#

Okay, so you're still talking about setting things in the Customer portal. I think that UI gives you an option to have the change cascade to all Subscription? (we focus more on helping developers work with our API, so sometimes I need reminders about what you're seeing if you're using hosted flows instead)

woeful nova
#

ok last Q after buy sub how i can set default in customer level?

median forum
#

Via our API? By making a request to update the Customer object and set the invoice_settings.default_payment_method field.

woeful nova
#

ok thank you Toby!

median forum
#

Any time!

woeful nova
#

when buy sub default_payment_method field on the Subscription not required right?

#

if not set it, it means this sub will use default card in customer level?

woeful nova
#

cool

hot widgetBOT
woeful nova
#

still here?

wintry bear
#

I'm taking over for toby

#

Do you have another question?

woeful nova
#

about this
is it means if customer not have any card, and then if he add first card , it will set as default auto?

#

i tested it but card not set as default

wintry bear
#

Can you share the request id where you attempted this?

woeful nova
#

req_LLR36crgfgdGmC

wintry bear
#

That's a different endpoint from your screenshot entirely

#

POST /v1/customers/:id/sources is the endpoint from your screenshot

#

You're calling POST /v1/payment_methods and then POST /v1/payment_methods/pm_1RgRmsBZmGtUq60juBc3fP59/attach

#

So expected behavior is totally different

woeful nova
#

and where is default?

#

it's first card as you see

woeful nova
wintry bear
#

Correct

#

Only for the endpoint in your screenshot

#

Which is POST /v1/customers/:id/sources

woeful nova
#

in my case i still need to make it default by myself

wintry bear
#

Correct

woeful nova
#

when use wallets to buy sub, how i can set customer card as default?

wintry bear
#

Up to you

#

Read the description of both of those params to see what makes the most sense for your use-case

woeful nova
#

i want customer level

#

when i have to mark it as default?

#

after success payment?

wintry bear
#

Up to you really

#

But that makes the most sense

#

Because then you know the payment method had a successful payment

woeful nova
#

cool

#

i have other Q

#

sec please

#

i want to prevent save same card

#

i use payment method api

#

also i use stripe express element for wallets

woeful nova
wintry bear
#

See above link

woeful nova
#

if card same, card will not be created right?

wintry bear
#

That's not how that works

#

We don't prevent duplicate cards from being created

#

See the link I sent you