API ReferenceIntegrationsKnowledge Base

Flutter Standard Plugin - API Classes and Methods

Documented below is the API package for the plugin.

Class#

Razorpay

Method (Open Checkout)#

The below method opens the checkout.

open(map<String, dynamic> options)

The options map has key as a required property. All other properties are optional. Refer to our standard checkout documentation for a complete list of options for the checkout form.

Method (Register Event Listeners)#

The below method registers event listeners for payment events.

on(String eventName, Function listener)

Method (Clear all Listeners)#

clear()

Event Names#

The event names have been exposed as strings 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 have been 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 Code

Description

NETWORK_ERROR

There was a network error. For example, loss of internet connectivity.

INVALID_OPTIONS

An issue with options passed in Razorpay.open.

PAYMENT_CANCELLED

User cancelled the payment.

TLS_ERROR

Device does not support TLS v1.1 or TLS v1.2.

UNKNOWN_ERROR

An unknown error occurred.