#DancingOmelette-rn-confirm

1 messages ยท Page 1 of 1 (latest)

somber otter
#

Hey there ๐Ÿ‘‹ could you provide a snippet of your code where you're making the confirmPayment request?

dark viper
somber otter
#

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.

dark viper
#

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

#

confirmPayment called on line 54 has no card information being specifically passed

somber otter
#

Thanks, taking a closer look

north willow
#

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

dark viper
#

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)

north willow
#

Which version of the library are you using?

#

That demo won't work for me unfortunately

dark viper
#

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

north willow
#

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

dark viper
#

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