#dpelkey98
1 messages · Page 1 of 1 (latest)
If you want you can use the createPaymentMethod call to create a payment method without attaching and confirming. I think it would have a fingerprint that you can check against your current fingerprints for that customer https://stripe.com/docs/js/payment_methods/create_payment_method
Hey Pompey, thanks for the suggestion. However, I'm using the React Native SDK and the <CardField> component. I don't see how I can use stripe/stripe-js with React Native. I have also looked into the API for creating a payment method on the backend[0], but it explicitly recommends not passing card details. For reference, I'm currently creating the SetupIntent using the pre-saved customer ID. From there it returns client_secret which I pass to confirmSetupIntent. Only after confirming does the return {setupIntent} have a fingerprint property.
[0] https://stripe.com/docs/api/payment_methods/create#create_payment_method-card
👋 stepping in here
There is a similar createPaymentMethod function in the React Native SDK: https://stripe.dev/stripe-react-native/api-reference/index.html#createPaymentMethod
Hey bismarck. I see that it needs token or paymentMethodId. I also see a createToken function directly beneath https://stripe.dev/stripe-react-native/api-reference/modules/Token.html#CreateCardTokenParams. Is this what I would use? Would there happen to be a practical example of this anywhere?
It returns a PaymentMethod ID, you don't need to pass one. You just pass paymentMethodType: 'Card' and it will grab the data from the CardField.
This isn't really the canonical flow so no don't believe there is an example unfortunately.
This seems reasonable. My only other question is; is there a way to confirm the payment method on front end for off-session payments and maintain SCA like confirmSetupIntent?
I'm not sure I fully understand. You would indeed use confirmSetupIntent for that.
So you use createPaymentMethod to check the fingerprint then you confirm a SetupIntent and pass that PaymentMethod ID to the SetupIntent.
I see. Sorry, I'm a bit new to the Stripe API/SDKs so I may be wording a bit weirdly. Just so I understand, I will still need to create a setupIntent to fetch the client_secret? Pass that to confirmSetupIntent(client_secret, {options}) and including the payment method ID as options.paymentMethodData.paymentMethodId?
If I remember correctly we don't expose the fingerprint client-side so you will need to pass the PaymentMethod ID to your server and retrieve it to check the fingerprint. This means that since you already have the PaymentMethod on your server you can just pass it to the SetupIntent when you creat that server-side (https://stripe.com/docs/api/setup_intents/create#create_setup_intent-payment_method) and then pass the client_secret back to the frontend and confirm as you mentioned above.
Ok, understood. I'll give that a shot. Thanks for both of your help
Sure thing