Closed abdulkadhir closed 5 years ago
I got an error window.Razorpay is not a constructor
`
placeOrder(){
let options = { "key": "RAZORPAY_KEY", "amount": this.state.amount, "name": "Merchant Name", "description": "Purchase Description", "image": "/logo.png", "handler": function (response){ alert(response.razorpay_payment_id); }, "prefill": { "name": "xyz", "email": "123@xyz.com" }, "notes": { "address": "Hello World" }, "theme": { "color": "#F37254" } }; const rzp = new window.Razorpay(options); rzp.open();
}
onClick={(e) => this.placeOrder()} color="primary" size="lg">Place order `
just add this to your index.html
I got the same error. Just use
const rzp = new window.Razorpay({key});
rzp.createPayment(options); // key not required
add in the HTML
Thank u So much @rocknegi
Thank u So much for providing solution@rocknegi
Thank you @rocknegi
I am getting same error for unit test TypeError: window.Razorpay is not a constructor But the razorpay page is working fine.. error only in unit test using jest
I got an error window.Razorpay is not a constructor
`
placeOrder(){
}
`