#cyril_paymentmethod-save
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/1285617180247068692
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
The card used ends in 1117 but it is not saved to the customer payment method. I want to save the card for future auto payment for the auto extended booking.
Hi ๐ you need to set a value for the setup_future_usage parameter on the Payment Intent then:
https://docs.stripe.com/api/payment_intents/create#create_payment_intent-setup_future_usage
You can do that either when creating or confirming the intent.
For reference, here's our guide for saving payment method details while also processing a payment:
https://docs.stripe.com/payments/save-during-payment
why the ID saved is pm_1Q03DmRudNHJ72xw7KTygo3m
it should be in this format card_1Q01XQRudNHJ72xwTz5mPeVn
No it shouldn't be. You're creating a Payment Method object and those have a pm_ prefix for their ID.
But is there a way to save the card id?
No, you're creating Payment Method objects, there is no card ID to be saved.
But the problem here when I set the a card to default for those cards that has pm_ prefix for their ID, I got an error.
It's hard to say for sure since that is a UI provided by Bubble that I'm not familiar with, but it looks like you're updating the wrong field on the Customer object. Seems like you're updating default_source instead of invoice_settings.default_payment_method:
https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method
invoice_settings.default_payment_method takes priority over default_source, so you don't have to worry about clearing out default_source when using a Payment Method instead.
how to save a card that the id will have a prefix of pm_
Sorry, not sure I'm following. Isn't that exactly what is happening? It's what you're already doing. You're creating a Payment Method with a type of card.
cyril_paymentmethod-save
Right now I have 2 options to save the payment method. First option is to save it just by adding a card which has a card_ prefix saved. The second is saving the method after the payment which has a pm_ prefix. But when I try to set default card that has card_ prefix, it doesn't work. So I need to have all the cards to have a prefix of pm_
@devout pecan The "prefix" as you say is based on how you wrote your entire integration. So the first step is to understand that as the developer building this.
I got it now, I should use invoice_settings.default_payment_method not the default_source when setting a default card.
correct
Thanks @jovial ocean and @somber otter for the help.