#DancingOmelette-rn-confirm
1 messages ยท Page 1 of 1 (latest)
Hey there ๐ could you provide a snippet of your code where you're making the confirmPayment request?
In your confirmPayment function call, I'm seeing that you pass it the client secret, a type, and billing details, but I'm not seeing card information being passed to it.
yes, that's how the stripe-react-native SDK is meant to be used as far as I can see (to ensure payment details can't be leaked inside your app accidentally). The CardField component is meant to hook into the stripe context automatically
see the example code here: https://github.com/stripe/stripe-react-native/blob/master/example/src/screens/WebhookPaymentScreen.tsx
confirmPayment called on line 54 has no card information being specifically passed
Thanks, taking a closer look
Hey @dark viper! Just been looking over the code you've shared. My initial suggestion would be for you to initialise Stripe.js outside of the component where you invoke <CardField />, ideally in a parent
In most cases we recommended initialising Stripe.js in the application root
thanks for that suggestion @north willow - however my initial version was using StripeProvider as a context wrapping the whole app, but that attempt had the same issue - I switched to the initStripe call here while trying to get it to work
Interestingly I just tried out the expo example snack and I get the same error when running it (trying the "Accept a payment" -> "Card element only" demo)
Which version of the library are you using?
That demo won't work for me unfortunately
v0.1.1
seems like quite an old version, now you mention it... that's the version I automatically got when adding it recently. I'll check if I can update it
I found a similar sounding issue that was addressed in 0.1.6: https://github.com/stripe/stripe-react-native/issues/371
Are you able to upgrade
Also, you could try asynchronously initialising Stripe.js in your effect:
useEffect(() => {
async function initialize() {
await initStripe({
publishableKey: pk_xxx,
});
}
initialize();
}, []);
Let me know how you get on, I'll be back soon
ok, I got everything updated, stripe-react-native usage with expo requires specific versions to be used together, I needed to update expo to the latest version and then I was able to use stripe-react-native 0.2.2, now it works as expected ๐ thanks @north willow