#corbin_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1247698391903895602
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
Do you have an example PaymentMethod ID I can look at?
Yeah, let me look one up.
pm_1PO77aGTpOhCAFHyIdo0zlNM
Is that right?
I read in the API docs that there is an allow_redisplay option that can be set on a PaymentMethod. However, if the payment method is added in the customer portal, I don't see any way of having control over that when they add a new card. I checked the API docs and nothing jumped out at me as allowing me to configure a customer portal to affect the allow_redisplay value of any payment methods a customer might add. I also don't see any options in the customer portal that would allow a customer to make the card visible later.
Right right. I wanted to look at how the billing portal created this PM, give me a few mins
ok, let me know if you need any more code. I can share how I am creating the checkout session and customer portal, if that is helpful
I think this is the guidance you're referring to: https://support.stripe.com/questions/prefilling-saved-cards-in-checkout
Though saved_payment_method_options.payment_method_save is for Checkout Sessions
Logs show that the Portal is using SetupIntents though so I'd expect future Checkout Sessions for a given customer to adhere to this logic: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-customer
So in my situation, I generate a customer id with my customer's email address before they ever navigate to a stripe-hosted page.
So I already have a customer id when they navigate to the customer portal page that I generate using the following code:
stripe.billingPortal.sessions.create({
customer: stripeCustomerId!,
return_url: returnUrl,
configuration: process.env.STRIPE_BILLING_PORTAL_CONFIGURATION_ID,
});
If they follow the link provided by the above code, it takes them to a customer portal where they can add payment methods.
My problem is that these payment methods do not show up when the go to a checkout session which I generate with the following code:
stripe.checkout.sessions.create({
customer: user.stripeCustomerId!,
mode: 'subscription',
line_items: [
{
price: priceID,
quantity: 1,
},
],
customer_update: {
address: 'auto',
shipping: 'auto',
name: 'never',
},
saved_payment_method_options: {
payment_method_save: 'enabled',
allow_redisplay_filters: ['always', 'limited', 'unspecified'],
},
shipping_address_collection: {
allowed_countries: ['US'],
},
billing_address_collection: 'required',
consent_collection: {
payment_method_reuse_agreement: {
position: 'auto',
},
terms_of_service: 'required',
},
allow_promotion_codes: true,
payment_method_collection: 'if_required',
// {CHECKOUT_SESSION_ID} is a string literal; do not change it!
// the actual Session ID is returned in the query parameter when your customer
// is redirected to the success page.
success_url: getAppBaseURL() + 'profile',
cancel_url: getAppBaseURL() + 'profile',
});
Based on what I see in the UI after a customer adds a payment method in the billing portal, the cards are being saved to the customer.
Yeah, I see the PM that you shared was added to the customer and was made their default for invoice_settings.default_payment_method
On your end, are you checking the event logs to troubleshoot?
I'm trying to reproduce this. So far, the only details that get pulled into Checkout from my portal-saved PM are the billing details
Ah, so you're having my same problem ๐
hello! stepping in on behalf of roadrunner, right now, since there is no way to configure allow_redisplay in the customer portal, I believe that we wouldn't prepopulate the PaymentMethod in a Checkout Session in subscription mode. If you want it to do so though and/or have the option available to be configured, I'd recommend writing in to https://support.stripe.com/contact/email
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Just make a feature request?
yep
aight