razorpay / react-native-razorpay

React Native wrapper for Razorpay's mobile SDKs
https://www.npmjs.com/package/react-native-razorpay
MIT License
125 stars 107 forks source link

[TypeError: Cannot read property 'open' of null] while RazorPay Payment Gateway Integration #465

Closed gausu60 closed 11 months ago

gausu60 commented 11 months ago

Package.json file

{ "name": "rzrpay", "version": "1.0.0", "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web" }, "dependencies": { "expo": "~49.0.15", "expo-status-bar": "~1.6.0", "react": "18.2.0", "react-native": "0.72.6", "react-native-razorpay": "^2.3.0" }, "devDependencies": { "@babel/core": "^7.20.0" }, "private": true }

PaymentScreen.js File

import { StatusBar } from 'expo-status-bar'; import { StyleSheet, Text, View,TouchableHighlight } from 'react-native'; import RazorpayCheckout from 'react-native-razorpay';

export default function App() { return (

{ var options = { description: 'Credits towards consultation', image: 'https://i.imgur.com/3g7nmJC.jpg', currency: 'INR', key: 'rzp_test_Sknlktafgjyvvd', amount: '5000', name: 'Acme Corp', order_id: 'order_DslnoIgkIDL8Zt',//Replace this with an order_id created using Orders API. prefill: { email: 'gaurav.kumar@example.com', contact: '9191919191', name: 'Gaurav Kumar' }, theme: {color: '#53a20e'} } RazorpayCheckout.open(options).then((data) => { // handle success alert(`Success: ${data.razorpay_payment_id}`); }).catch((error) => { // handle failure console.log(`Error: ${error}`); }); }}> Pay ![error_razorpay](https://github.com/razorpay/react-native-razorpay/assets/54934021/8ede07f6-27cc-46f7-8f8e-be3da08a4f7f)