#nerder

1 messages · Page 1 of 1 (latest)

dull hawkBOT
fresh radish
#
edgy vapor
#

ok, in my case I'm doing this:

    const setupIntent = await this.stripe.setupIntents.create(
      {
        payment_method_types: ['card', 'sepa_debit'],
        customer: customerId,
      },
      {
        stripeAccount: stripeAccountId,
      },
    );
#

first creating a setup intent, returning the client secret to the UI

#

My doubt is, I can't simply call the customer API and set the payment method as default

#

because is the frontend that is completing that with the client secret no?

fresh radish
#

I don't understand the question. You can make an Update Customer API call at any point after the creation of the Payment Method

edgy vapor
#

I try to explain better, the integration i've made is the following:

#
  1. User attempt to attach a new payment method
  2. Frontend call endpoint to create a setup intent (using the code I showed you)
  3. Backend reply with client_secret
  4. Frontend confirm the setup intent and set the payment method
#

now the payment method is set, but is not the default

#

My options now are:

  1. Listen for payment_method.attached event in the webhook and setup the payment method as default on the customer
  2. As soon as the frontend confirms the setup_intent I perform another call to the Backend to setup that payment method as the default one
#

There is a better 3rd option here? If not, of the 2 I mentioned, which one is the best?

fresh radish
#

There are a lot of reasons to choose either, so it's largely up to you to decided based on your integration, but I don't know of another 3rd option