#xmy_code

1 messages ¡ Page 1 of 1 (latest)

oblique oasisBOT
#

👋 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/1283168200321798166

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

stuck hawk
#

Hi there

#

Do you have a request ID or a SetupIntent ID you can share?

zenith oasis
#

I think I managed to get it to work (maybe a caching problem). But I'm still confused by it

#

Does a setup intent have to be specifically created for one payment method? Or can I do it for multiple things

#

The error message indicates it has to be done specifically?

stuck hawk
#

What do you mean exactly by "multiple things"?

#

A SetupIntent is essentially a state machine used for collecting payment details from a customer. Once the SetupIntent is in canceled or succeeded state, those are terminal states so nothing else can be done with that SetupIntent

zenith oasis
#

As in can I use the same client secret to set up multiple payment methods

So this piece of code seems to be working:

const setupIntent = await stripe.setupIntents.create({
  customer: customer.id,
  payment_method_types: ["card", "paypal"],
  payment_method_data: {
    type: "paypal",
  },
});

But does that mean this will only work for PayPal? Or can I also set up cards with it

stuck hawk
#

A SetupIntent's client secret can only be used to set up a single payment method (of any type you specify though)

#

So if you've used a SetupIntent to save a card PaymentMethod and now you want to save a Paypal PaymentMethod, you'll need to create a second SetupIntent.

#

The code above can be used to create a SetupIntent that can be used to create either a card PaymentMethod or a Paypal PaymentMethod

zenith oasis
#

Understood, the thing I'm trying to understand is why I have to specify payment_method_data for my code to work for PayPal

zenith oasis
#

Okay, but there is no side-effect when I use a setup intent specifying this to set up a different payment method?