#splue_code
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/1313970066257084427
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
thank you in advance!
Good question, checking our docs for what might be missing here
Are you setting setup_future_usage and turning on payment_method_save in your initial checkout session that takes the payment for that customer? We show how to do that in this doc section https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=checkout#save-payment-methods-to-charge-them-off-session
well for this customer i
- created them in the dashboard
- manually added their payment method
- set their payment method to default
i thought adding a card manually in teh dashboard would properly save hteir card?
if i go thorugh the normal flow in my app, it would the original checkout session which saves the card looks like this
export const createCheckoutSession = async ( email: string, request: Request) => {
return stripe.checkout.sessions.create({
currency: 'usd',
ui_mode: 'embedded',
customer_email: email,
payment_method_types: ['card'],
mode: 'setup',
customer_creation: 'always',
billing_address_collection: 'required',
return_url: '{{urll}}',
});
};
and then i also have a webhook listener which listens for checkout session compeltion events to set the customer's saved payment as the default payment
const paymentMethods = await this.stripe.customers.listPaymentMethods(
customerId,
{
limit: 1,
},
)
if (paymentMethods.data.length <= 0) {
console.error(`Customer missing payment data ${customerId}`)
return null
}
const customer = await this.stripe.customers.update(customerId, {
invoice_settings: {
default_payment_method: paymentMethods.data[0].id,
},
})
Ah gotcha, in that case you need to make an API call to update the payment method and set allow_redisplay to true
The dashboard saves the PM properly for re-use but it doesn't save it in the way that Checkout needs it to to display it when the customer returns
ok so if i manually add a card in the dashboard, i still need to update the allow_redisplay field to true?
why does the allow_redisplay method return true here?
stripe customers retrieve_payment_method cus_RKsHoq3BqPRDMO pm_1QSCWwRwZsexd3LvkUORArwi
{
"id": "pm_1QSCWwRwZsexd3LvkUORArwi",
"object": "payment_method",
"allow_redisplay": "always"
...
}
Oh whoops, I forgot it is an enum rather than a boolean. So you are saying that was already set for that PM but it still isn't showing up in Checkout?
im saying that
- i created the card in the stripe dashboard
- when creating the card int eh dashboard, there is no option to set allow_redisplay
- so i checked what allow_redisplay for this newly created payment method using the stripe cli
- when i get back the payment method object, it shows allow_redisplay set as always
so if it's already set to "always" why is it not appearing in my checkout session?
That I am unsure of, can you create another Checkout Session for that customer and send me the ID here?
sure thing
1 sec
cs_test_a11WN2cM5OehbdpQRq5tu27vS7yY6WnPFlLhKo7dZ39NtMit3dBI60er3a
Thank you, checking in to that
thanks pompey
so you inspired me to try my regular flow, instead of using the dashboard to add a card...
thank you so much because that worked!
when i use my regular flow, i see my presaved credit card
when i use the dashboard, i don't.
not sure why but im okay with that
Sounds good! Glad we could get this working in some way or another. I will still look in to this in case anything needs fixing and will escalate to my colleagues if necessary. Have a nice rest of your day!
i think part of the confusion is that when I add a card from the dashboard and set it as the customer's default payment method, i expect it to show in checkout sessions