react-native-razorpay: [TypeError: Cannot read property 'open' of null] while RazorPay Payment Gateway Integration latest version
can anyone help me ?
[TypeError: Cannot read property ‘open’ of null] this error occured when i click on pay btn
this is my code below :-
import RazorpayCheckout from “react-native-razorpay”;
<TouchableOpacity
style={styles.paybtn}
onPress={() => {
var options = {
description: ‘Online Furniture Sales’,
image: ‘https://i.imgur.com/3g7nmJC.jpg’,
currency: ‘INR’,
key: ‘
’,
amount: ‘5000’,
name: ‘VIVDeal’,
order_id: ‘’,//Replace this with an order_id created using Orders API.
prefill: {
email: ‘gausu@gmail.com’,
contact: ‘919165482569’,
name: ‘Gausuddeen Shaikh’
},
theme: {color: ‘#53a20e’}
}
RazorpayCheckout.open(options).then((data) => {
// handle success
alert(
Success: ${data.razorpay_payment_id});
}).catch((error) => {
// handle failure
console.log('Error: ', error);
alert(Error: ${error.code} | ${error.description});
});
}}
>
<Text style={styles.payBtnText} >Proceed To Pay</Text>
</TouchableOpacity>
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (7 by maintainers)
@gausu60 Just tried too. Here are the commands I followed.
npx expo prebuildnpx expo start-> expo go builda-> running app on android {you’ll see error mentioned above}s-> switch to development modea-> run app on android.It loaded the checkout page. Could you please try these in order and see if it works?