Closed aliasgar-choolawala closed 6 years ago
@aliasgar-choolawala, I am also facing this issue. I have used redux for my project with structured folder. Not able to access new razorpay() class although i have included CDN in public/index.html.
@shashank7200 it will be much appreciated if you help me out.
@aliasgar-choolawala @daudtacto i got similar issue and i made it by working as const rzp1 = new window.Razorpay(options); //instead of new Razorpay(options) rzp1.open();
const rzp1 = new window.Razorpay(options); //instead of new Razorpay(options)
this seems to be a possible solution for this. I will just rewrite the logic.
@aliasgar-choolawala @daudtacto @Daudsayyed I am just closing this issue, If you face any problem, just create a new issue. :+1:
any other way of doing the same without using window
window
Thanks a lots
I am getting an error window.Razorpay is not defined in the code below, and I have written this code inside useEffect const script = document.createElement('script') script.src = "https://checkout.razorpay.com/v1/checkout.js" script.async = true document.body.appendChild(script) const rzp1 = new window.Razorpay(options); rzp1.open(); setLoading(!loading);
@Chelsea67jain You are adding your declaration of the script to be run Asynchronously, In that case, the Razorpay
object will not be immediately available to the window
. You'll have to wait for the script to be loaded before you execute the Razorpay
logic.
Hi, I have defined the checkout.js script in index.html in public folder. The components are in the src folder, and index.js is also in the src folder.
Got the error 'Razorpay' is not defined when trying to run the project.
Any idea about this?