'How to get card number and cvv details in react native expo(stripe)

How to get cvv and card number from given card details in expo project for stripe payment method.

<CardField
          
          postalCodeEnabled={false}
          
          placeholder={{
            number: '4242 4242 4242 4242',
          }}
          cardStyle={{
            backgroundColor: '#FFFFFF',
            textColor: '#000000',
          }}
          style={{ height: 50, }}
          onCardChange={(cardDetails) => {
            setCardDetails(cardDetails)
          }}
        
        />


Solution 1:[1]

You will get the card details when onCardChange call every time the value change like

onCardChange={(cardDetails) => {
  // here "cardDetails" is the object and you can get the value like

  const validNumber = cardDetails.validNumber;
  const validCVC = cardDetails.validCVC;
}}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nooruddin Lakhani