API Classes and Methods

API classes and methods available for the Flutter plugin.

Available in

IN

India

MY

Malaysia


Documented below is the API package for the plugin.

open(map<String, dynamic> 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:

for EVENT_PAYMENT_SUCCESS
for EVENT_PAYMENT_FAILURE
for EVENT_EXTERNAL_WALLET

clear()

Clears all listeners.

Handy Tips

The options map has key as a required property in the open checkout method. All other properties are optional. Know about all the

.

The event names have been exposed as strings by the Razorpay class.

Event NameDescription
EVENT_PAYMENT_SUCCESSThe payment was successful.
EVENT_PAYMENT_ERRORThe payment was not successful.
EVENT_EXTERNAL_WALLETAn external wallet was selected.

Field NameData TypeDescription
paymentIdstringThe ID for the payment.
orderIdstringThe order ID if the payment was for an order, otherwise null .
signaturestringThe signature to be used for payment verification. Only valid for orders, otherwise null .

Field NameData TypeDescription
codeintegerThe .
messagestringThe .

Field NameData TypeDescription
walletNamestringThe name of the external wallet selected.


The error codes are exposed as integers by the Razorpay class. The error code is available as the code field of the PaymentFailureResponse instance passed to the callback.

Error CodeDescription
NETWORK_ERRORThere was a network error. For example, loss of internet connectivity.
INVALID_OPTIONSAn issue with options passed in Razorpay.open .
PAYMENT_CANCELLEDUser cancelled the payment.
TLS_ERRORDevice does not support TLS v1.1 or TLS v1.2.
UNKNOWN_ERRORAn unknown error occurred.

Is this integration guide useful?


integrate flutter sdk
api classes and methods
flutter plugin
event responses
error codes