#george-paymentintent-paymentmethod
1 messages · Page 1 of 1 (latest)
@river spoke why are you trying to detach a PM? Can you provide a bit more specificities?
george-paymentintent-paymentmethod
so if we create a payment intent and the user adds their payment details, but then decides they want to change their details and put new ones in
in that case you just confirm the PaymentIntent with the new PaymentMethod, that's all you need to do
Can you give a concrete example so that I can look at it?
sure
i am on the test account atm
I create an intent with capture mode manual
give the secret to the client, and their i enter the test card details.
Sorry all I need is a concrete PaymentIntent id pi_123 to look at
Your PaymentIntent is in status: "requires_capture". You already hold those funds. You need to cancel that PaymentIntent to return the funds and create a separate PaymentIntent for the new card details
right
how would I go about allowing the user to enter their payment details without holding the funds?
That kind of doesn't really make sense as a flow usually. Why would you want to do that? Can you explain your flow of funds clearly?
so, when the user is on our app, they can enter their payment details, and then see a summary and then click book
so the details have been entered before hand
but we dont want to hold any funds yet
as they might change payment details before they click book
https://site-admin.stripe.com/docs/payments/accept-a-payment-deferred you likely want this flow instead in that case. It lets you collect card details first, create a PaymentMethod and then later confirm the PaymentIntent
it's just web right now unfortunately. We're working on it for Mobile SDKs but it will take a while
so essentially when payment details are confirmed, the amount is automatically held?
yes
i see
so i guess thats why some companies will make an authorization request (ie amount = 0), and then process the same method with a new intenet?
no definitely not. You can't do $0 intent, and no one would do that flow
so how do companies create an athorization request?
I'm sorry I have no idea what that word could mean to you
An "authorization" is usually the same as "placing a hold on the card" which is exactly what you are already doing
right
basically I am trying to relate to a service that I have already used, for example paying for an uber, where by entering my details onto the app to save, there is a payment of 0 value that is made
and that essentially "confirms" my card details
without actually creating a payment
You want a SetupIntent in that case: https://stripe.com/docs/payments/setup-intents
right i see
so with this method, i can basically save the customer's details before processing the payment
yes
but you really should not do this if you plan to charge them immediately
Uber does this because they won't know the amount to charge until the end of the ride which can be hours later
as in because of best practices or some other particular reason?
many reasons: 3DS twice, higher cost, higher risk of declines, so really no reason at all to do this in your case
I think you want to use https://stripe.dev/stripe-react-native/api-reference/index.html#createPaymentMethod with https://stripe.dev/stripe-react-native/api-reference/index.html#CardField for now to collect card details first and then confirm the PaymentIntent on your second step/screen
that is interesting
generally though there is one thing that we need to check before we attempt payment and that is issuing country
the reason being is we have 2 stripe accounts, one for accepting eu issued cards, and one for non eu
so the process was :
1-ask user to select region (EU, non-eu)
2-depending on their answer, initiate stripe component with correct strip account key
3-ask user to enter details and confirm
4-if issuing country is not in the region initially specified, then throw error
for this reason, we want to know if the card being entered is indeed in the right region before actually holding any money
yeah so the flow I just outlined works
will this create a method without an intent?
yes
sure!
sounds good
does a payment method get created?
that i can retrieve server side?
if I do stripe.createPaymentMethod
it requires paymentIntents.CreatePaymentMethodData
where do i get the data for that?
oh got it
stripe.createPaymentMethod({ elements })
you're supposed to use CardField
this is entirely separate from https://stripe.com/docs/payments/accept-a-payment-deferred
like ignore that link entirely it's not relevant to you on React Native
gotcha
so i am now testing the web integration
so yeah for web I would go with that deferred flow
so i tried that
i get an error when i submit the details
use createPaymentMethod with the Payment Element, your elements instance must be created with paymentMethodCreation: 'manual'.
even though i have inititated it that way]
<Elements
options={{
// clientSecret: clientSecret,
appearance: {
theme: "stripe",
},
payment_method_creation: 'manual',
paymentMethodTypes: ['card'],
amount: 1000,
mode: 'payment',
currency: 'eur'
}}
stripe={stripePromise}
>
<CheckoutForm />
</Elements>
payment_method_creation and paymentMethodCreation are different
its been a long day...
worked!
so now that i got the details, i can do my checks
with regards to 3ds, if required it will happen with the intent im guessing
yes
ok great
perfect
question,
sorry
if we wanted to integrate google pay and apple pay
which we do want to
can we create a payment method with the google/apple pay details before the intent as well?
yes
ok great and that we can do on react native?
I would say yes but I'm not certain. Best to start and try a lot of this 🙂
@river spoke https://stripe.com/docs/apple-pay?platform=react-native#create-payment-method is what you want for ApplePay and Google Pay
@sand rapids who just joined can likely help
ok great
i think this makes sense
i think you have answered all my questions
thanks a lot for your help
very much appreciated
have a good rest of your day!
You too! Let us know if we can help any further!
one last thing! sorry.. once a user enters their card details, and a method is created, if the cvc was incorrect and we have to go back to the payment element, is there a way to re-initialise it with the same payment method id so that the data is prefilled?
No that's not possible.
so if the following happens:
1- user enters card details
2- server creates payment intent
3- cvc error is returned
do we then need to ask the user to enter all the details again? and do we need to create a new intent or can we update the intent with a new payment method id?
Ah actually, we do support CVC Recollection with the React Native SDK via createTokenForCVCUpdate: https://stripe.dev/stripe-react-native/api-reference/index.html#createTokenForCVCUpdate
So if it is just a CVC issue then you would not need to recollect entirety of card details
how do i then use the token?
oh right
ok
and this only applies to cvc
so if the error was because of an incorrect expiry date, then we need to ask the user for all the details from scratch?
Expiry isn't sensitive so you could collect this yourself if you want and update the PaymentMethod server-side: https://stripe.com/docs/api/payment_methods/update#update_payment_method-card
right i see
so for react native we just use the tokenising function, and then confirm the payment with the token, or we could send the token to the server and let server handle the confirmation correct?
Yep pretty much
ok i see
is there a similar function on Stripe elements for web for cvc tokenisation?
i see that there is a CardCvcElement
Yep
Whoops that is the React Native version
But if you flip to "Web" at the top you will see the Web example which uses cardCVCElement
Not sure what you mean by that exactly?
so that we have full control on the input fields, and then tokenise card data and send the tokens in the request
You mean are we moving towards having users build their own inputs for these details and then creating tokens from your custom inputs?
more like, will you be creating functions like createTokenForCVCUpdate but for the card number too
That is what createPaymentMethod does
yes but it still uses stripe's render components
Yeah but you could pass data to your server directly to create PaymentMethods on your server if you are PCI compliant. We just do not recommend that as it means a high PCI burden.
yes ofc ofc, i mean if you had the tokenize card number on front end, then you could send the token and have full control on reder, and not need to be PCI compliant?
We don't really have any plans to have separate functions in our client SDKs for tokenizing individual pieces of data other than CVC if that is what you are getting at.
Yeah there is no real reason to tokenize card number without expiry
So you can't do those separately
CVC is separate since CVC can't be stored, so CVC re-collection comes into play
gotcha
will createTokenForCVCUpdate ever be needed when dealing with google/apple pay?
It works the same with Google/Apple Pay really.
Google/Apple Pay just gives you a PaymentMethod object
Just like Card Field and createPaymentMethod will
So you can use createTokenForCVCUpdate with a wallet-generated PM if you want
Sure thing!