#beard_checkout-defaultpm
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/1301247115929980929
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
@astral hedge I don't really understand what you are asking sorry. Can you reword? What do you mean by "attach" what is happening or not happening that is confusing you?
so when I create a checkout session with customer id(customer pre created). the customer goes to checkout and fill in payment info. now I want to attach this payment method to that customer for which the checkout session was created
like in future if I want to get payment info. its not available through customer and instead I have to go find it through subscription
What does "go find it through the subscription" mean?
like the payment method is not available via customer query. I have to query subscription to get the payment method id
Gotcha, so that's the whole misunderstanding!
A Customer can have 0, 1 or N PaymentMethods. You can use the List Customer PaymentMethods API to find the whole list https://docs.stripe.com/api/payment_methods/customer_list
After the Checkout Session is completed, we make the PaymentMethod that was collected the default on the Subscription in the default_payment_method property.
So you can access that and then store it in your own database for example. Or use the List PaymentMethods API I mentioned to show a list of saved card/PaymentMethods
Does that make sense?
beard_checkout-defaultpm
but that is the is the issue. list payment method for customer is empty after the checkout
the payment method is only available on subscription
nvm
you are right
sorry, I was looking at the wrong customer
All good, I made the same mistake this morning debugging another issue and kept saying "where the heck is that card" ๐
also list payment method does not mention the default method ?
correct that's entirely expected. It's a list of PaymentMethods and none are the default automatically
you can set a specific default globally on the Customer yourself using invoice_settings[default_payment_method] if you want
the problem i have is that when a customer subscribe with checkout session. the payment method is what the customer entered. I can query subscription to get that payment method. all good to this point.
then when a customer updates a payment method (we use billing portal session for this). so the updated method is now default for that customer and this will used for the future subscription payment. but that is not a subscription payment method and subscription payment method is empty. so to display current method, I have to check subscription endpoint and then fallback to customer endpoint
correct you do. See the link I shared just above since I knew you'd ask that
ok, thanks. going over it now