Sandip Biswas
Sandip Biswas

Reputation: 350

ReferenceError: Can't find variable in react native

ReferenceError: Can't find variable: Razorpay

Trying to create a Razorpay order with my key_id and key_secret in React native with the following code, but getting the above error. Clearly I have to import Razorpay from somewhere, but I'm not sure from where I need to import it.

enter image description here

var instance = new Razorpay({
                  key_id: 'MY_KEY_ID',
                  key_secret: 'MY_KEY_SECRET'
                });

Upvotes: 1

Views: 2261

Answers (1)

Max
Max

Reputation: 4749

The code you provided is taken from server side node sdk. You should never put any secret keys in client side applications as these can easily be stolen by anyone who has your app. For react-native you need client-side sdk, read here for iOS and Android installation and import instructions

Upvotes: 2

Related Questions