question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Card details not complete when using confirmPayment

See original GitHub issue

Describe the bug After navigating through my app and entering the payment screen, my payments always fails with the message Card details not complete, which is exactly the same error that these other issues were reporting: #350, #371 and #502. This error was supposed to be fixed after the release of v0.2.0, but it is the same for me even after upgrading the library. The error occured to every device that I have used for tests, both Android and iOS.

To Reproduce Follow the steps: Accepting a Payment.

Expected behavior The payment should be confirmed and show up in Stripe Dashboard.

Additional context This seems to be related to how the CardField is being deallocated by the CardViewManager, since applying the #379 changes fixed the error for me, but it was rejected since it might cause unexpected behavior.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:41

github_iconTop GitHub Comments

12reactions
ingowonnercommented, Aug 26, 2021

We had the same issue and found a solution which is working for us. The strange thing was in the beginning everything went like it should an no error was thrown. At some point we were getting the Card details not complete even though the CardField onCardChange event responding with complete: true. 🤯

To fix this we needed to make sure that the CardField component has rendered when Stripe is initializing (If it is rendered conditionally, e.g. after some loading has finished … it wont work). To achieve this we ditched the StripeProvider, switched to initStripe() and placed it in the same component in which CardField is used. Should look something like this:

const Payment = () => {
  // Init Stripe
  useEffect(() => {
    async function initialize() {
      await initStripe({
        publishableKey: PUBLIC_KEY,
      });
    }
    initialize().catch(console.error);
  }, []);

  return (
    <View>
      <CardField
        postalCodeEnabled={false}
        onCardChange={(cardDetails: CardFieldInput.Details) => {
          setCardDataComplete(cardDetails.complete);
        }}
     />
   </View>
  );
}

And voila it’s working again!! 🥳

Edit: Almost forgot the mention the versions we use

"expo": "^42.0.0",
"@react-navigation/native": "^5.9.4",
"@stripe/stripe-react-native": "0.1.4",
4reactions
NorthBlue333commented, Feb 23, 2022

Hi @alexsegura Happens to me too, using Expo SDK 44 and Stripe SDK 0.2.3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"You must provide card details, token or paymentMethodId ...
confirm the payment if (error) { console.log("Unable to process payment"); } else { const { paymentIntent, error } = await confirmPayment( ...
Read more >
stripe.confirmPayment - Stripe JS Reference
confirmPayment to confirm a PaymentIntent using data collected by the Payment Element. When called, stripe.confirmPayment will attempt to complete any ...
Read more >
Confirm a card payment with Stripe React Native - YouTube
In this episode, you'll learn how to confirm a card payment with the ... React Native: Accepting payments with Stripe in your app,...
Read more >
How to Make Mobile Payment in React Native App with Stripe ...
For testing, we will be using test card numbers provided by Stripe. ... we won't use it in our test app but you...
Read more >
How to add Stripe Payment in react native app - Medium
Next, we'll send the client secret and user details to the confirmPayment method, which you can access with ... Confirm the payment with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found