I am using @stripe/stripe-react-native”: “^0.37.2” for payment. I want to make payment manually by enter card details in form and and pass parameter in createPaymentMethod and i am getting error create Payment failed Card details not complete.
import React, { useState } from ‘react’;
import { StripeProvider, useStripe } from ‘@stripe/stripe-react-native’;
const { paymentMethod, error } = await stripe.createPaymentMethod({
type: ‘Card’,
billingDetails: {
name: ‘Jenny Rosen’,
},
card: {
number: ‘4242424242424242’,
expMonth: 12,
expYear: 2025,
cvc: ‘123’,
},
});
if (error) {
console.error(‘create Payment failed’, error.message);
} else if (paymentMethod) {
setPaymentMethodId(paymentMethod.id);
}
} catch (error) {
console.error(‘Error’, ‘An error occurred, please try again.’);
}
};
return (
<StripeProvider publishableKey="YOUR_PUBLISHABLE_KEY">
{/* Your form and submit button */}
<button onClick={onSubmitSteps}>Submit Payment</button>
</StripeProvider>
);
};
export default MyComponent;
`
I need solution to create payment
vishal maheshwari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.