Crashes upon invoking expo-payments-stripe API of createTokenWithCardAsync

Please provide the following:

  1. SDK Version: 39
  2. Platforms(Android/iOS/web/all): Android managed workflow
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I am using expo-payments-stripe for Android with managed workflow(unejected), and got crash upon using API createTokenWithCardAsync. I followed the example as similar as stated in the docs, but upon running the function on pressing a button, it always crashed.

const stripePay = () => {
    const params = {
      // mandatory
      number: '4242424242424242',
      expMonth: 11,
      expYear: 17,
      cvc: '223',
    };

    try {
      const token = await Stripe.createTokenWithCardAsync(params);
      console.log(token);
    } catch (err) {
      console.log(err);
    }
}

I have added the setOptionsAsync with the appropriate parameter, in a useEffect() and cant simply get the error. It just crashes upon invoking the function.

And I tried the API paymentRequestWithCardFormAsync, it works flawlessly. It just I do not this in my back end.

Anyone get this crash and know how to fix it? Feel free to reply. Thanks

Were you able to resolve this? I am running into the same issue with no console log after calling createTokenWithCardAsync

No, I haven’t. I changed into Stripe.paymentRequestWithCardFormAsync() API instead. It works great for Android but never tried for iOS.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.