#corbin_api

1 messages ยท Page 1 of 1 (latest)

fleet pythonBOT
#

๐Ÿ‘‹ 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.

honest berry
#

Do you have an example PaymentMethod ID I can look at?

native hill
#

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.

honest berry
#

Right right. I wanted to look at how the billing portal created this PM, give me a few mins

native hill
#

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

honest berry
fleet pythonBOT
native hill
#

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.

honest berry
#

Yeah, I see the PM that you shared was added to the customer and was made their default for invoice_settings.default_payment_method

native hill
#

On your end, are you checking the event logs to troubleshoot?

honest berry
#

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

native hill
#

Ah, so you're having my same problem ๐Ÿ˜„

loud geyser
#

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

native hill
#

Just make a feature request?

loud geyser
#

yep

native hill
#

aight