Razorpay Class
Method
open(map options)
: Opens the checkout.
on(String eventName, Function listener)
: Registers event listeners for payment events.- eventName: The name of the event.
listener: The function to be called. The listener should accept a single argument of the following type: PaymentSuccessResponse for EVENT_PAYMENT_SUCCESS.- PaymentFailureResponse for EVENT_PAYMENT_FAILURE.
- ExternalWalletResponse for EVENT_EXTERNAL_WALLET.
clear()
: Clears all listeners.
Handy Tips
options map has key as a required property in the open checkout method. All other properties are optional. Know about all the options available on checkout form.
Event Names
The event names have been exposed asstrings by the Razorpay class.
Event Name | Description
EVENT_PAYMENT_SUCCESS | The payment was successful.
EVENT_PAYMENT_ERROR | The payment was not successful.
EVENT_EXTERNAL_WALLET | An external wallet was selected.PaymentSuccessResponse
Field Name | Data Type | Description
paymentId | string | The ID for the payment.
orderId | string | The order ID if the payment was for an order, otherwise null.
signature | string | The signature to be used for payment verification. Only valid for orders, otherwise null.
PaymentFailureResponse
Field Name | Data Type | Description
code | integer | The error code.
message | string | The error message.
ExternalWalletResponse
Field Name | Data Type | Description
walletName | string | The name of the external wallet selected.
Error Codes
The error codes are exposed as integers by theRazorpay class. The error code is available as the code field of the PaymentFailureResponse instance passed to the callback.