I am trying to integrate Razorpay with my Nuxt App. And everything is fine when I run it in test mode. I don't know why but it does not require order_id in test mode. But when I tried to add order_id field for doing payment in live mode. The below code is required first for Initialization of Razorpay.
Note - Got this from Razorpay Docs https://razorpay.com/docs/api/orders/#create-an-order
var instance = new Razorpay({
key_id: 'YOUR_KEY_ID', //I added my live mode key_id here.
key_secret: 'YOUR_KEY_SECRET' ////I added my live mode key_secret here.
})
And to create order, this code is given.
instance.orders.create({amount, currency, receipt, notes})
I wrote the code in methods and console.log(instance) to see what is coming in it. But as soon as I pressed the button to run the function. It gave me error No key passed. Even though my keys are correct. Here is my code.
pay() {
var instance = new Razorpay({
key_id: 'my_actual_key_id',
key_secret: 'my_actual_key_secret',
})
console.log('Ins', instance)
var options = {
amount: 1000,
currency: "INR",
receipt: "order_rcptid_11"
};
instance.orders.create(options, function(err, order) {
console.log(order);
});
},
I don't know why it is giving No key passed error. Is there a mistake in my code? I cannot find any other way to get order_id. Also unable to find any answer or video that is creating order_id, through this method.