I am new to react native and I'm currently working on an eCommerce app and trying to figure out how to implement stripe checkout. Would there be any good example or tutorial I can watch to find and implement stripe checkout?
I have tried to implement it on my own, I'm not exactly sure where I can find the session key. Leaving it empty just keeps the payment on loading.
If anyone can help or share a guide I can follow that would be great thanks.
import StripeCheckout from 'react-native-stripe-checkout-webview';
export default class CheckOutScreen extends Component {
render() {
return (
<StripeCheckout
stripePublicKey='pk_test_ox4IkFUhPnLRLsQSfVDyo--------'
checkoutSessionInput={{
sessionId: ' ',
}}
onSuccess={({ checkoutSessionId }) => {
console.log(`Stripe checkout session succeeded. session id: ${checkoutSessionId}.`);
}}
onCancel={() => {
console.log(`Stripe checkout session cancelled.`);
}}
/>
);
}
}
You can follow the example on their GitHub. However, this is a third-party library library (not developed by Stripe). You can follow the official React Native Stripe guide here.