#ginger_reactnative-setupintent

1 messages · Page 1 of 1 (latest)

wicked folioBOT
pure surgeBOT
#

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.

wicked folioBOT
#

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

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

trim snow
#

@split star I'm happy to help but I don't really get the question you have and what the issue is. When using CardField or CardForm you should still be able to confirm the SetupIntent right?
Why are you trying to call createPaymentMethod exactly?

#

ginger_reactnative-setupintent

#

Also if you are doing a rewrite why don't you use PaymentSheet instead?

split star
#

PaymentSheet allows users to delete all payment methods which we cannot allow since we have to keep at least one on file

#

I am trying to createPaymentMethod to attach the card to the customer

#

I can and do confirm setupintent to retrieve the setupIntentClientSecret but am having trouble figuring out how to then save and attach the payment information from cardform or cardfield to the customer

trim snow
#

gotcha, let me have a look

split star
#

thank you!

trim snow
#

this is a canonical example using CardField + confirmPayment() right? So you should be able to use that with confirmSetup() and not createPaymentMethod()

split star
#

this example charges the user though right?

#

I am trying to just add a card without charging

trim snow
#

sure but it's the exact same thing with SetupIntent. There's no reason to call createPaymentMethod

split star
#

sorry I don't think I understand, can I use SetupIntent to attach the card to the customer?

trim snow
#

yes

split star
#

could you please provide more info on how this works? what param do I pass the card info in as from cardform/cardfield?

#

just : payment_method_types: ['card'],?

#

or sorry payment_method: card?

trim snow
#

I'm sorry you're being a bit too meta.

#

What have you tried? You should be able to do exactly the code on that doc but replace PaymentIntent with SetupIntent and confirmPayment with confirmSetup. Like what is not working?

split star
#

Okay so I can create a setupIntent but then get the error that confirmSetup is not a function

trim snow
#

did you import it? Can you share real exact code?

split star
#

I might be misunderstanding...but am I able to attach the card to the customer when creating the setupIntent?:
const setupIntent = await stripe.setupIntents.create({
customer: customerId,
automatic_payment_methods: {
enabled: true,
},
// some how pass the info from card field/form in here?
});

I know this works:
const setupIntent = await stripe.setupIntents.create({
customer: stripeCustomerId,
payment_method: paymentMethodId,
confirm: true
});
but I am not sure how to get the paymentMethodId from CardField/CardForm

#

import {
useStripe,
CardForm,
CardField,
confirmSetup
} from "@stripe/stripe-react-native";

trim snow
#

but am I able to attach the card to the customer when creating the setupIntent
A SetupIntent is what you use to collect payment method details (such as card details) and save those for future payments. So it will automatically attach the card for you, that's what it's for

#

Why do you have confirmPayment in your import exactly? You're not going to use it. You need confirmSetup right?

split star
#

Sorry yes confirmSetup

trim snow
#

Ah it's apparently called confirmSetupIntent().
Why? I wish I knew. Sometimes I'm baffled by how different every SDK is (╯°□°)╯︵ ┻━┻

#

Sorry React Native is not a framework I understand much about so I can't easily repro and give you code that works

split star
#

okay let me try that

#

thanks so much for your help