Skip to main content
Available in🇮🇳 India
The createPayment method must be called synchronously within user-initiated action. Hence, this method doesn’t work if the pop-up blocker is enabled. You can decouple pop-up opening and payment creation if you need to perform any asynchronous operation such as sending an AJAX request before starting payment. Check the code below:
After you make AJAX requests, emit resume or cancel the event using this code:

Format of Data Object and Success/Error Handlers

payment.resume : Event initiates the usual payment process and emits payment.success or payment.error events according to the payment result. payment.cancel : Razorpay will not initiate the payment.