Payment Gateway

5 mins

5 mins

Sahaj Rana

Published on May 10, 2025

How to Integrate Razorpay in Your Flutter App (with Code)

Integrate Razorpay with Flutter in minutes! This tutorial covers SDK setup, payment options, and best practices for secure mobile payment gateways in 2025.
Integrate Razorpay with Flutter in minutes! This tutorial covers SDK setup, payment options, and best practices for secure mobile payment gateways in 2025.

Overview

Overview

Overview

Overview

In today’s app ecosystem, integrating a secure and reliable payment gateway is a must. Among the many available options, Razorpay has emerged as one of the most trusted and widely used payment solutions. It enables seamless acceptance of payments through credit cards, debit cards, UPI, net banking, and digital wallets. With a feature-rich mobile SDK, Razorpay offers Flutter developers a robust way to embed payments directly into their apps. In this guide, we'll explore how to integrate Razorpay into a Flutter application and deliver a smooth transaction experience for users.

In today’s app ecosystem, integrating a secure and reliable payment gateway is a must. Among the many available options, Razorpay has emerged as one of the most trusted and widely used payment solutions. It enables seamless acceptance of payments through credit cards, debit cards, UPI, net banking, and digital wallets. With a feature-rich mobile SDK, Razorpay offers Flutter developers a robust way to embed payments directly into their apps. In this guide, we'll explore how to integrate Razorpay into a Flutter application and deliver a smooth transaction experience for users.

In today’s app ecosystem, integrating a secure and reliable payment gateway is a must. Among the many available options, Razorpay has emerged as one of the most trusted and widely used payment solutions. It enables seamless acceptance of payments through credit cards, debit cards, UPI, net banking, and digital wallets. With a feature-rich mobile SDK, Razorpay offers Flutter developers a robust way to embed payments directly into their apps. In this guide, we'll explore how to integrate Razorpay into a Flutter application and deliver a smooth transaction experience for users.

In today’s app ecosystem, integrating a secure and reliable payment gateway is a must. Among the many available options, Razorpay has emerged as one of the most trusted and widely used payment solutions. It enables seamless acceptance of payments through credit cards, debit cards, UPI, net banking, and digital wallets. With a feature-rich mobile SDK, Razorpay offers Flutter developers a robust way to embed payments directly into their apps. In this guide, we'll explore how to integrate Razorpay into a Flutter application and deliver a smooth transaction experience for users.

Introduction

Introduction

Introduction

Introduction

Razorpay is a prominent online payment gateway that provides secure and scalable payment solutions for businesses. It supports a broad range of payment modes, including credit/debit cards, UPI, net banking, digital wallets, and EMI options. For Flutter apps, Razorpay offers dedicated SDKs and APIs that allow for easy integration and customization. Developers can tailor the payment interface to match the look and feel of their app, adjusting colors, logos, and design elements to maintain brand consistency. Razorpay also prioritizes security by using advanced encryption and tokenization techniques. Post-payment, it offers callback mechanisms to notify the app of payment status, allowing dynamic updates to the UI based on the result.

Razorpay is a prominent online payment gateway that provides secure and scalable payment solutions for businesses. It supports a broad range of payment modes, including credit/debit cards, UPI, net banking, digital wallets, and EMI options. For Flutter apps, Razorpay offers dedicated SDKs and APIs that allow for easy integration and customization. Developers can tailor the payment interface to match the look and feel of their app, adjusting colors, logos, and design elements to maintain brand consistency. Razorpay also prioritizes security by using advanced encryption and tokenization techniques. Post-payment, it offers callback mechanisms to notify the app of payment status, allowing dynamic updates to the UI based on the result.

Razorpay is a prominent online payment gateway that provides secure and scalable payment solutions for businesses. It supports a broad range of payment modes, including credit/debit cards, UPI, net banking, digital wallets, and EMI options. For Flutter apps, Razorpay offers dedicated SDKs and APIs that allow for easy integration and customization. Developers can tailor the payment interface to match the look and feel of their app, adjusting colors, logos, and design elements to maintain brand consistency. Razorpay also prioritizes security by using advanced encryption and tokenization techniques. Post-payment, it offers callback mechanisms to notify the app of payment status, allowing dynamic updates to the UI based on the result.

Razorpay is a prominent online payment gateway that provides secure and scalable payment solutions for businesses. It supports a broad range of payment modes, including credit/debit cards, UPI, net banking, digital wallets, and EMI options. For Flutter apps, Razorpay offers dedicated SDKs and APIs that allow for easy integration and customization. Developers can tailor the payment interface to match the look and feel of their app, adjusting colors, logos, and design elements to maintain brand consistency. Razorpay also prioritizes security by using advanced encryption and tokenization techniques. Post-payment, it offers callback mechanisms to notify the app of payment status, allowing dynamic updates to the UI based on the result.

Initializing Razorpay in Flutter

Initializing Razorpay in Flutter

Initializing Razorpay in Flutter

Initializing Razorpay in Flutter

There are a few essential steps to follow for integrating or initializing Razorpay in your Flutter application.

To begin with, let’s explore how to create your Razorpay profile to access API keys and monitor activity.

  • Create your account on Razorpay by entering your mobile number. You’ll be redirected to the dashboard, which opens in test mode by default.

  • The Razorpay Test Mode simulates the live environment. It lets you safely test your integration. Once verified, you can switch to Live Mode to start real payments.

To access Live Mode, use the dropdown from the top-right profile menu. To activate it, you’ll need to complete a basic KYC form.

  • From the left menu bar, go to Account & SettingsAPI Keys. You can copy the generated key and use it in your app integration.

  • Checkout Settings → Branding:
    In this section, you can customize the payment screen. Add your brand’s theme color, upload a square logo (max 1MB, min 256×256 px), or choose a language. You can also collect user email addresses optionally. A live preview is visible on the dashboard.

  • Capture & Refund Settings → Default Refund Speed:
    Select between Normal Refund (free, 5–7 days) or Instant Refund (charges apply, but faster).

  • Account & Settings → Email:
    Here, add one or more email addresses (separated by commas) to receive notifications about transactions, settlements, webhooks, and daily reports.

There are a few essential steps to follow for integrating or initializing Razorpay in your Flutter application.

To begin with, let’s explore how to create your Razorpay profile to access API keys and monitor activity.

  • Create your account on Razorpay by entering your mobile number. You’ll be redirected to the dashboard, which opens in test mode by default.

  • The Razorpay Test Mode simulates the live environment. It lets you safely test your integration. Once verified, you can switch to Live Mode to start real payments.

To access Live Mode, use the dropdown from the top-right profile menu. To activate it, you’ll need to complete a basic KYC form.

  • From the left menu bar, go to Account & SettingsAPI Keys. You can copy the generated key and use it in your app integration.

  • Checkout Settings → Branding:
    In this section, you can customize the payment screen. Add your brand’s theme color, upload a square logo (max 1MB, min 256×256 px), or choose a language. You can also collect user email addresses optionally. A live preview is visible on the dashboard.

  • Capture & Refund Settings → Default Refund Speed:
    Select between Normal Refund (free, 5–7 days) or Instant Refund (charges apply, but faster).

  • Account & Settings → Email:
    Here, add one or more email addresses (separated by commas) to receive notifications about transactions, settlements, webhooks, and daily reports.

There are a few essential steps to follow for integrating or initializing Razorpay in your Flutter application.

To begin with, let’s explore how to create your Razorpay profile to access API keys and monitor activity.

  • Create your account on Razorpay by entering your mobile number. You’ll be redirected to the dashboard, which opens in test mode by default.

  • The Razorpay Test Mode simulates the live environment. It lets you safely test your integration. Once verified, you can switch to Live Mode to start real payments.

To access Live Mode, use the dropdown from the top-right profile menu. To activate it, you’ll need to complete a basic KYC form.

  • From the left menu bar, go to Account & SettingsAPI Keys. You can copy the generated key and use it in your app integration.

  • Checkout Settings → Branding:
    In this section, you can customize the payment screen. Add your brand’s theme color, upload a square logo (max 1MB, min 256×256 px), or choose a language. You can also collect user email addresses optionally. A live preview is visible on the dashboard.

  • Capture & Refund Settings → Default Refund Speed:
    Select between Normal Refund (free, 5–7 days) or Instant Refund (charges apply, but faster).

  • Account & Settings → Email:
    Here, add one or more email addresses (separated by commas) to receive notifications about transactions, settlements, webhooks, and daily reports.

There are a few essential steps to follow for integrating or initializing Razorpay in your Flutter application.

To begin with, let’s explore how to create your Razorpay profile to access API keys and monitor activity.

  • Create your account on Razorpay by entering your mobile number. You’ll be redirected to the dashboard, which opens in test mode by default.

  • The Razorpay Test Mode simulates the live environment. It lets you safely test your integration. Once verified, you can switch to Live Mode to start real payments.

To access Live Mode, use the dropdown from the top-right profile menu. To activate it, you’ll need to complete a basic KYC form.

  • From the left menu bar, go to Account & SettingsAPI Keys. You can copy the generated key and use it in your app integration.

  • Checkout Settings → Branding:
    In this section, you can customize the payment screen. Add your brand’s theme color, upload a square logo (max 1MB, min 256×256 px), or choose a language. You can also collect user email addresses optionally. A live preview is visible on the dashboard.

  • Capture & Refund Settings → Default Refund Speed:
    Select between Normal Refund (free, 5–7 days) or Instant Refund (charges apply, but faster).

  • Account & Settings → Email:
    Here, add one or more email addresses (separated by commas) to receive notifications about transactions, settlements, webhooks, and daily reports.

Integrate Razorpay in app | Dart code

Integrate Razorpay in app | Dart code

Integrate Razorpay in app | Dart code

Integrate Razorpay in app | Dart code

There are several additional configuration options available in Razorpay. You can explore and customize them as per your application’s requirements.

Now, let’s walk through the steps required to integrate Razorpay into our Flutter application using Dart.

Add Dependencies

Start by opening the pubspec.yaml file and adding the Razorpay dependency under the dependencies section. Use the latest version and run flutter pub get to install it.

yamlCopyEditrazorpay_flutter: ^1.3.5

OS Versions & Platform Setup

Android

Ensure that the minimum SDK version is 19 or above.
Open android/app/build.gradle And update:

gradleCopyEditminSdkVersion 19

Proguard Rules

If you're using ProGuard for code shrinking, add the following to proguard-rules.pro in android/app:

proguardCopyEdit-keepattributes *Annotation*
-dontwarn com.razorpay.**
-keep class com.razorpay.** {*;}
-optimizations !method/inlining/
-keepclasseswithmembers class * {
  public void onPayment*(...);
}

iOS

Set the minimum iOS deployment target to 10.0 in your ios/Podfile:

rubyCopyEditplatform :ios, '10.0'

Enabling Bitcode

Modify the post_install section in your Podfile as follows:

rubyCopyEditconfig.build_settings['ENABLE_BITCODE'] = 'YES'
config.build_settings['SWIFT_VERSION'] = '5.0'

Import Razorpay SDK

In your Dart file, import the Razorpay SDK:

dartCopyEditimport 'package:razorpay_flutter/razorpay_flutter.dart';

Initialize Razorpay

Create an instance of the Razorpay class and initialize it inside the initState() Method of your Flutter widget.

dartCopyEditlate Razorpay razorpay;

@override
void initState() {
  super.initState();
  razorpay = Razorpay();
  razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
  razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
  razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);
}

Replace <your_api_key> With the actual key from your Razorpay dashboard.

Attach Event Listeners

Razorpay SDK emits events for payment success, failure, or wallet selection. Use .on() to attach handlers:

dartCopyEditrazorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);

Define Handlers

Define methods to handle the respective payment outcomes:

dartCopyEditvoid _handlePaymentSuccess(PaymentSuccessResponse response) {
  // Handle success
}

void _handlePaymentError(PaymentFailureResponse response) {
  // Handle failure
}

void _handleExternalWallet(ExternalWalletResponse response) {
  // Handle wallet selection
}

Dispose Razorpay Listeners

To avoid memory leaks, clear listeners in the dispose() method:

dartCopyEdit@override
void dispose() {
  razorpay.clear();
  super.dispose();
}

Trigger Payment Checkout

To initiate a payment, use the razorpay.open() Method with a configuration map:

dartCopyEditvar options = {
  'key': '<YOUR_KEY_HERE>',
  'amount': 100, // in paise
  'name': 'Chris Evans',
  'description': 'Bungalow',
  'prefill': {
    'contact': '1234567890',
    'email': 'evans@razorpay.com'
  }
};

razorpay.open(options);

This completes the Razorpay integration setup for your Flutter application on both Android and iOS platforms.

There are several additional configuration options available in Razorpay. You can explore and customize them as per your application’s requirements.

Now, let’s walk through the steps required to integrate Razorpay into our Flutter application using Dart.

Add Dependencies

Start by opening the pubspec.yaml file and adding the Razorpay dependency under the dependencies section. Use the latest version and run flutter pub get to install it.

yamlCopyEditrazorpay_flutter: ^1.3.5

OS Versions & Platform Setup

Android

Ensure that the minimum SDK version is 19 or above.
Open android/app/build.gradle And update:

gradleCopyEditminSdkVersion 19

Proguard Rules

If you're using ProGuard for code shrinking, add the following to proguard-rules.pro in android/app:

proguardCopyEdit-keepattributes *Annotation*
-dontwarn com.razorpay.**
-keep class com.razorpay.** {*;}
-optimizations !method/inlining/
-keepclasseswithmembers class * {
  public void onPayment*(...);
}

iOS

Set the minimum iOS deployment target to 10.0 in your ios/Podfile:

rubyCopyEditplatform :ios, '10.0'

Enabling Bitcode

Modify the post_install section in your Podfile as follows:

rubyCopyEditconfig.build_settings['ENABLE_BITCODE'] = 'YES'
config.build_settings['SWIFT_VERSION'] = '5.0'

Import Razorpay SDK

In your Dart file, import the Razorpay SDK:

dartCopyEditimport 'package:razorpay_flutter/razorpay_flutter.dart';

Initialize Razorpay

Create an instance of the Razorpay class and initialize it inside the initState() Method of your Flutter widget.

dartCopyEditlate Razorpay razorpay;

@override
void initState() {
  super.initState();
  razorpay = Razorpay();
  razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
  razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
  razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);
}

Replace <your_api_key> With the actual key from your Razorpay dashboard.

Attach Event Listeners

Razorpay SDK emits events for payment success, failure, or wallet selection. Use .on() to attach handlers:

dartCopyEditrazorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);

Define Handlers

Define methods to handle the respective payment outcomes:

dartCopyEditvoid _handlePaymentSuccess(PaymentSuccessResponse response) {
  // Handle success
}

void _handlePaymentError(PaymentFailureResponse response) {
  // Handle failure
}

void _handleExternalWallet(ExternalWalletResponse response) {
  // Handle wallet selection
}

Dispose Razorpay Listeners

To avoid memory leaks, clear listeners in the dispose() method:

dartCopyEdit@override
void dispose() {
  razorpay.clear();
  super.dispose();
}

Trigger Payment Checkout

To initiate a payment, use the razorpay.open() Method with a configuration map:

dartCopyEditvar options = {
  'key': '<YOUR_KEY_HERE>',
  'amount': 100, // in paise
  'name': 'Chris Evans',
  'description': 'Bungalow',
  'prefill': {
    'contact': '1234567890',
    'email': 'evans@razorpay.com'
  }
};

razorpay.open(options);

This completes the Razorpay integration setup for your Flutter application on both Android and iOS platforms.

There are several additional configuration options available in Razorpay. You can explore and customize them as per your application’s requirements.

Now, let’s walk through the steps required to integrate Razorpay into our Flutter application using Dart.

Add Dependencies

Start by opening the pubspec.yaml file and adding the Razorpay dependency under the dependencies section. Use the latest version and run flutter pub get to install it.

yamlCopyEditrazorpay_flutter: ^1.3.5

OS Versions & Platform Setup

Android

Ensure that the minimum SDK version is 19 or above.
Open android/app/build.gradle And update:

gradleCopyEditminSdkVersion 19

Proguard Rules

If you're using ProGuard for code shrinking, add the following to proguard-rules.pro in android/app:

proguardCopyEdit-keepattributes *Annotation*
-dontwarn com.razorpay.**
-keep class com.razorpay.** {*;}
-optimizations !method/inlining/
-keepclasseswithmembers class * {
  public void onPayment*(...);
}

iOS

Set the minimum iOS deployment target to 10.0 in your ios/Podfile:

rubyCopyEditplatform :ios, '10.0'

Enabling Bitcode

Modify the post_install section in your Podfile as follows:

rubyCopyEditconfig.build_settings['ENABLE_BITCODE'] = 'YES'
config.build_settings['SWIFT_VERSION'] = '5.0'

Import Razorpay SDK

In your Dart file, import the Razorpay SDK:

dartCopyEditimport 'package:razorpay_flutter/razorpay_flutter.dart';

Initialize Razorpay

Create an instance of the Razorpay class and initialize it inside the initState() Method of your Flutter widget.

dartCopyEditlate Razorpay razorpay;

@override
void initState() {
  super.initState();
  razorpay = Razorpay();
  razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
  razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
  razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);
}

Replace <your_api_key> With the actual key from your Razorpay dashboard.

Attach Event Listeners

Razorpay SDK emits events for payment success, failure, or wallet selection. Use .on() to attach handlers:

dartCopyEditrazorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);

Define Handlers

Define methods to handle the respective payment outcomes:

dartCopyEditvoid _handlePaymentSuccess(PaymentSuccessResponse response) {
  // Handle success
}

void _handlePaymentError(PaymentFailureResponse response) {
  // Handle failure
}

void _handleExternalWallet(ExternalWalletResponse response) {
  // Handle wallet selection
}

Dispose Razorpay Listeners

To avoid memory leaks, clear listeners in the dispose() method:

dartCopyEdit@override
void dispose() {
  razorpay.clear();
  super.dispose();
}

Trigger Payment Checkout

To initiate a payment, use the razorpay.open() Method with a configuration map:

dartCopyEditvar options = {
  'key': '<YOUR_KEY_HERE>',
  'amount': 100, // in paise
  'name': 'Chris Evans',
  'description': 'Bungalow',
  'prefill': {
    'contact': '1234567890',
    'email': 'evans@razorpay.com'
  }
};

razorpay.open(options);

This completes the Razorpay integration setup for your Flutter application on both Android and iOS platforms.

There are several additional configuration options available in Razorpay. You can explore and customize them as per your application’s requirements.

Now, let’s walk through the steps required to integrate Razorpay into our Flutter application using Dart.

Add Dependencies

Start by opening the pubspec.yaml file and adding the Razorpay dependency under the dependencies section. Use the latest version and run flutter pub get to install it.

yamlCopyEditrazorpay_flutter: ^1.3.5

OS Versions & Platform Setup

Android

Ensure that the minimum SDK version is 19 or above.
Open android/app/build.gradle And update:

gradleCopyEditminSdkVersion 19

Proguard Rules

If you're using ProGuard for code shrinking, add the following to proguard-rules.pro in android/app:

proguardCopyEdit-keepattributes *Annotation*
-dontwarn com.razorpay.**
-keep class com.razorpay.** {*;}
-optimizations !method/inlining/
-keepclasseswithmembers class * {
  public void onPayment*(...);
}

iOS

Set the minimum iOS deployment target to 10.0 in your ios/Podfile:

rubyCopyEditplatform :ios, '10.0'

Enabling Bitcode

Modify the post_install section in your Podfile as follows:

rubyCopyEditconfig.build_settings['ENABLE_BITCODE'] = 'YES'
config.build_settings['SWIFT_VERSION'] = '5.0'

Import Razorpay SDK

In your Dart file, import the Razorpay SDK:

dartCopyEditimport 'package:razorpay_flutter/razorpay_flutter.dart';

Initialize Razorpay

Create an instance of the Razorpay class and initialize it inside the initState() Method of your Flutter widget.

dartCopyEditlate Razorpay razorpay;

@override
void initState() {
  super.initState();
  razorpay = Razorpay();
  razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
  razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
  razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);
}

Replace <your_api_key> With the actual key from your Razorpay dashboard.

Attach Event Listeners

Razorpay SDK emits events for payment success, failure, or wallet selection. Use .on() to attach handlers:

dartCopyEditrazorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, _handlePaymentError);
razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, _handleExternalWallet);

Define Handlers

Define methods to handle the respective payment outcomes:

dartCopyEditvoid _handlePaymentSuccess(PaymentSuccessResponse response) {
  // Handle success
}

void _handlePaymentError(PaymentFailureResponse response) {
  // Handle failure
}

void _handleExternalWallet(ExternalWalletResponse response) {
  // Handle wallet selection
}

Dispose Razorpay Listeners

To avoid memory leaks, clear listeners in the dispose() method:

dartCopyEdit@override
void dispose() {
  razorpay.clear();
  super.dispose();
}

Trigger Payment Checkout

To initiate a payment, use the razorpay.open() Method with a configuration map:

dartCopyEditvar options = {
  'key': '<YOUR_KEY_HERE>',
  'amount': 100, // in paise
  'name': 'Chris Evans',
  'description': 'Bungalow',
  'prefill': {
    'contact': '1234567890',
    'email': 'evans@razorpay.com'
  }
};

razorpay.open(options);

This completes the Razorpay integration setup for your Flutter application on both Android and iOS platforms.

Creating Payment Requests

Creating Payment Requests

Creating Payment Requests

Creating Payment Requests

In this section, we’ll learn how to make a payment request using Razorpay in a Flutter application.

After completing the setup steps, focus on writing the Dart code that defines the options map and handles the event listeners for success and failure.

On tapping a payment button, you’ll capture the user-entered amount and pass it to the Razorpay SDK. This will open the Razorpay payment dialog, where the user can select a payment method, enter their credentials (such as card PIN), and complete the transaction.

To achieve this, create a TextEditingController to accept user input for the payment amount. Since Razorpay requires the amount in the smallest currency unit (like paisa in INR), make sure to multiply the entered value by 100 before passing it to the amount field inside the options map.


TextEditingController amount=TextEditingController();


  void openCheckout() async {
var options = {
  'key': '<YOUR_KEY_HERE>',
    'amount': int.parse(amount.text)*100, // This way
  'name': 'Chris Evans',
  'description': 'Bunglow',
  'prefill': {
    'contact': '1234567890',
    'email': 'evans@razorpay.com'
  }
};
}


// Elevated Button to click and move on Razorpay screen
 ElevatedButton(onPressed: (){
                openCheckout();
              },
                  child: Text("Pay Now"))

In this section, we’ll learn how to make a payment request using Razorpay in a Flutter application.

After completing the setup steps, focus on writing the Dart code that defines the options map and handles the event listeners for success and failure.

On tapping a payment button, you’ll capture the user-entered amount and pass it to the Razorpay SDK. This will open the Razorpay payment dialog, where the user can select a payment method, enter their credentials (such as card PIN), and complete the transaction.

To achieve this, create a TextEditingController to accept user input for the payment amount. Since Razorpay requires the amount in the smallest currency unit (like paisa in INR), make sure to multiply the entered value by 100 before passing it to the amount field inside the options map.


TextEditingController amount=TextEditingController();


  void openCheckout() async {
var options = {
  'key': '<YOUR_KEY_HERE>',
    'amount': int.parse(amount.text)*100, // This way
  'name': 'Chris Evans',
  'description': 'Bunglow',
  'prefill': {
    'contact': '1234567890',
    'email': 'evans@razorpay.com'
  }
};
}


// Elevated Button to click and move on Razorpay screen
 ElevatedButton(onPressed: (){
                openCheckout();
              },
                  child: Text("Pay Now"))

In this section, we’ll learn how to make a payment request using Razorpay in a Flutter application.

After completing the setup steps, focus on writing the Dart code that defines the options map and handles the event listeners for success and failure.

On tapping a payment button, you’ll capture the user-entered amount and pass it to the Razorpay SDK. This will open the Razorpay payment dialog, where the user can select a payment method, enter their credentials (such as card PIN), and complete the transaction.

To achieve this, create a TextEditingController to accept user input for the payment amount. Since Razorpay requires the amount in the smallest currency unit (like paisa in INR), make sure to multiply the entered value by 100 before passing it to the amount field inside the options map.


TextEditingController amount=TextEditingController();


  void openCheckout() async {
var options = {
  'key': '<YOUR_KEY_HERE>',
    'amount': int.parse(amount.text)*100, // This way
  'name': 'Chris Evans',
  'description': 'Bunglow',
  'prefill': {
    'contact': '1234567890',
    'email': 'evans@razorpay.com'
  }
};
}


// Elevated Button to click and move on Razorpay screen
 ElevatedButton(onPressed: (){
                openCheckout();
              },
                  child: Text("Pay Now"))

In this section, we’ll learn how to make a payment request using Razorpay in a Flutter application.

After completing the setup steps, focus on writing the Dart code that defines the options map and handles the event listeners for success and failure.

On tapping a payment button, you’ll capture the user-entered amount and pass it to the Razorpay SDK. This will open the Razorpay payment dialog, where the user can select a payment method, enter their credentials (such as card PIN), and complete the transaction.

To achieve this, create a TextEditingController to accept user input for the payment amount. Since Razorpay requires the amount in the smallest currency unit (like paisa in INR), make sure to multiply the entered value by 100 before passing it to the amount field inside the options map.


TextEditingController amount=TextEditingController();


  void openCheckout() async {
var options = {
  'key': '<YOUR_KEY_HERE>',
    'amount': int.parse(amount.text)*100, // This way
  'name': 'Chris Evans',
  'description': 'Bunglow',
  'prefill': {
    'contact': '1234567890',
    'email': 'evans@razorpay.com'
  }
};
}


// Elevated Button to click and move on Razorpay screen
 ElevatedButton(onPressed: (){
                openCheckout();
              },
                  child: Text("Pay Now"))

Error Handling and Troubleshooting

Error Handling and Troubleshooting

Error Handling and Troubleshooting

Error Handling and Troubleshooting

Use try-catch blocks to handle Razorpay exceptions caused by network issues or invalid data. Always check for internet connectivity before initiating payments, and show clear messages if offline.

Test your integration thoroughly using Razorpay’s Test Mode to simulate different scenarios and ensure your app behaves correctly before going live.

Error Codes

Razorpay returns specific error codes and messages on failure. Handle these by showing user-friendly messages to guide users in resolving issues smoothly.

Event Names

Razorpay provides predefined event names through its SDK. You can use these to handle specific payment outcomes and display relevant messages to the user accordingly.

PaymentSuccessResponse

PaymentFailureResponse

ExternalWalletResponse


Use try-catch blocks to handle Razorpay exceptions caused by network issues or invalid data. Always check for internet connectivity before initiating payments, and show clear messages if offline.

Test your integration thoroughly using Razorpay’s Test Mode to simulate different scenarios and ensure your app behaves correctly before going live.

Error Codes

Razorpay returns specific error codes and messages on failure. Handle these by showing user-friendly messages to guide users in resolving issues smoothly.

Event Names

Razorpay provides predefined event names through its SDK. You can use these to handle specific payment outcomes and display relevant messages to the user accordingly.

PaymentSuccessResponse

PaymentFailureResponse

ExternalWalletResponse


Use try-catch blocks to handle Razorpay exceptions caused by network issues or invalid data. Always check for internet connectivity before initiating payments, and show clear messages if offline.

Test your integration thoroughly using Razorpay’s Test Mode to simulate different scenarios and ensure your app behaves correctly before going live.

Error Codes

Razorpay returns specific error codes and messages on failure. Handle these by showing user-friendly messages to guide users in resolving issues smoothly.

Event Names

Razorpay provides predefined event names through its SDK. You can use these to handle specific payment outcomes and display relevant messages to the user accordingly.

PaymentSuccessResponse

PaymentFailureResponse

ExternalWalletResponse


Use try-catch blocks to handle Razorpay exceptions caused by network issues or invalid data. Always check for internet connectivity before initiating payments, and show clear messages if offline.

Test your integration thoroughly using Razorpay’s Test Mode to simulate different scenarios and ensure your app behaves correctly before going live.

Error Codes

Razorpay returns specific error codes and messages on failure. Handle these by showing user-friendly messages to guide users in resolving issues smoothly.

Event Names

Razorpay provides predefined event names through its SDK. You can use these to handle specific payment outcomes and display relevant messages to the user accordingly.

PaymentSuccessResponse

PaymentFailureResponse

ExternalWalletResponse


Troubleshooting Common Errors

Troubleshooting Common Errors

Troubleshooting Common Errors

Troubleshooting Common Errors

Troubleshooting Common Errors

1. Gradle Build Error

If you encounter an error like:

build5k4e4j3j5df049skzqsgxyjtv.android() is applicable for argument types: (build5k4e4j3j5df049skzqsgxyjtv$runclosure2) values: [build5k4e4j3j5df049skzqsgxyjtv$runclosure2@f9d1390]
BUILD FAILED in 783ms

Solution:
Remove the following lines from your app/build.gradle file under the release build type:

useProguard true  // Remove this
proguardFiles(
    getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
) // Remove this

Your buildTypes should look like this:

buildTypes {
    release {
        signingConfig signingConfigs.debug
        minifyEnabled true
        shrinkResources true
    }
}

2. Invalid Payment ID Error

You might see an error like:

{
  "code": "BADREQUESTERROR",
  "description": "1689231342456046 is not a valid id",
  "step": "paymentinitiation",
  "reason": "inputvalidationfailed",
  "source": "business"
}

Solution:
Check your options map in Razorpay. You may be passing an incorrect or malformed orderId or other values.

3. General Debugging Tip

If you're facing other issues, add debug logs throughout your code. Logging will help pinpoint where the issue is occurring, making it easier to fix and ensure a successful integration.

Troubleshooting Common Errors

1. Gradle Build Error

If you encounter an error like:

build5k4e4j3j5df049skzqsgxyjtv.android() is applicable for argument types: (build5k4e4j3j5df049skzqsgxyjtv$runclosure2) values: [build5k4e4j3j5df049skzqsgxyjtv$runclosure2@f9d1390]
BUILD FAILED in 783ms

Solution:
Remove the following lines from your app/build.gradle file under the release build type:

useProguard true  // Remove this
proguardFiles(
    getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
) // Remove this

Your buildTypes should look like this:

buildTypes {
    release {
        signingConfig signingConfigs.debug
        minifyEnabled true
        shrinkResources true
    }
}

2. Invalid Payment ID Error

You might see an error like:

{
  "code": "BADREQUESTERROR",
  "description": "1689231342456046 is not a valid id",
  "step": "paymentinitiation",
  "reason": "inputvalidationfailed",
  "source": "business"
}

Solution:
Check your options map in Razorpay. You may be passing an incorrect or malformed orderId or other values.

3. General Debugging Tip

If you're facing other issues, add debug logs throughout your code. Logging will help pinpoint where the issue is occurring, making it easier to fix and ensure a successful integration.

Troubleshooting Common Errors

1. Gradle Build Error

If you encounter an error like:

build5k4e4j3j5df049skzqsgxyjtv.android() is applicable for argument types: (build5k4e4j3j5df049skzqsgxyjtv$runclosure2) values: [build5k4e4j3j5df049skzqsgxyjtv$runclosure2@f9d1390]
BUILD FAILED in 783ms

Solution:
Remove the following lines from your app/build.gradle file under the release build type:

useProguard true  // Remove this
proguardFiles(
    getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
) // Remove this

Your buildTypes should look like this:

buildTypes {
    release {
        signingConfig signingConfigs.debug
        minifyEnabled true
        shrinkResources true
    }
}

2. Invalid Payment ID Error

You might see an error like:

{
  "code": "BADREQUESTERROR",
  "description": "1689231342456046 is not a valid id",
  "step": "paymentinitiation",
  "reason": "inputvalidationfailed",
  "source": "business"
}

Solution:
Check your options map in Razorpay. You may be passing an incorrect or malformed orderId or other values.

3. General Debugging Tip

If you're facing other issues, add debug logs throughout your code. Logging will help pinpoint where the issue is occurring, making it easier to fix and ensure a successful integration.

Troubleshooting Common Errors

1. Gradle Build Error

If you encounter an error like:

build5k4e4j3j5df049skzqsgxyjtv.android() is applicable for argument types: (build5k4e4j3j5df049skzqsgxyjtv$runclosure2) values: [build5k4e4j3j5df049skzqsgxyjtv$runclosure2@f9d1390]
BUILD FAILED in 783ms

Solution:
Remove the following lines from your app/build.gradle file under the release build type:

useProguard true  // Remove this
proguardFiles(
    getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
) // Remove this

Your buildTypes should look like this:

buildTypes {
    release {
        signingConfig signingConfigs.debug
        minifyEnabled true
        shrinkResources true
    }
}

2. Invalid Payment ID Error

You might see an error like:

{
  "code": "BADREQUESTERROR",
  "description": "1689231342456046 is not a valid id",
  "step": "paymentinitiation",
  "reason": "inputvalidationfailed",
  "source": "business"
}

Solution:
Check your options map in Razorpay. You may be passing an incorrect or malformed orderId or other values.

3. General Debugging Tip

If you're facing other issues, add debug logs throughout your code. Logging will help pinpoint where the issue is occurring, making it easier to fix and ensure a successful integration.

Project Structure

Project Structure

Project Structure

Project Structure

This application will consist of two Dart files: main.dart and razorpay.dart.
First, follow all the integration steps outlined above, and then use the following code to implement and run the Razorpay payment process in your Flutter app.

#main.dart

import 'package:flutter/material.dart';
import 'package:razorpay/razorpay.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Razorpay Integration',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const RazorPayIntegration(),
    );
  }
}
razorpay.dart

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:razorpay_flutter/razorpay_flutter.dart';

class RazorPayIntegration extends StatefulWidget {
  const RazorPayIntegration({Key? key}) : super(key: key);

  @override
  _RazorPayIntegrationState createState() => _RazorPayIntegrationState();
}

class _RazorPayIntegrationState extends State<RazorPayIntegration> {
  late Razorpay razorpay;
  final TextEditingController amountController = TextEditingController();

  @override
  void initState() {
    super.initState();
    razorpay = Razorpay();
    razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, handlePaymentSuccess);
    razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, handlePaymentError);
    razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, handleExternalWallet);
  }

  @override
  void dispose() {
    razorpay.clear();
    amountController.dispose();
    super.dispose();
  }

  void handlePaymentSuccess(PaymentSuccessResponse response) {
    Fluttertoast.showToast(msg: "Payment Successful");
    print("Payment ID: ${response.paymentId}");
  }

  void handlePaymentError(PaymentFailureResponse response) {
    Fluttertoast.showToast(msg: "Payment Failed");
    print("Error: ${response.message}");
  }

  void handleExternalWallet(ExternalWalletResponse response) {
    Fluttertoast.showToast(msg: "External Wallet Selected");
  }

  void openCheckout() {
    var options = {
      'key': 'Your-Key',
      'amount': int.parse(amountController.text) * 100, // Convert to paisa
      'name': 'Riya Tyagi',
      'description': 'Payment',
      'timeout': 300,
      'prefill': {
        'contact': '7409616828',
        'email': 'riya@razorpay.com'
      },
      'external': {
        'wallets': ['paytm']
      }
    };

    try {
      razorpay.open(options);
    } catch (e) {
      debugPrint("Error: ${e.toString()}");
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Padding(
              padding: const EdgeInsets.all(20.0),
              child: TextField(
                controller: amountController,
                keyboardType: TextInputType.number,
                decoration: const InputDecoration(
                  hintText: "Enter the amount you want to pay",
                ),
              ),
            ),
            const SizedBox(height: 50),
            ElevatedButton(
              onPressed: openCheckout,
              child: const Text("Pay Now"),
            ),
          ],
        ),
      ),
    );
  }
}

UI Note

The above screen layout includes a basic text input field and a “Pay Now” button. You can further enhance the UI with animations, themes, or validation logic to give it a more polished look and feel.

This application will consist of two Dart files: main.dart and razorpay.dart.
First, follow all the integration steps outlined above, and then use the following code to implement and run the Razorpay payment process in your Flutter app.

#main.dart

import 'package:flutter/material.dart';
import 'package:razorpay/razorpay.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Razorpay Integration',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const RazorPayIntegration(),
    );
  }
}
razorpay.dart

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:razorpay_flutter/razorpay_flutter.dart';

class RazorPayIntegration extends StatefulWidget {
  const RazorPayIntegration({Key? key}) : super(key: key);

  @override
  _RazorPayIntegrationState createState() => _RazorPayIntegrationState();
}

class _RazorPayIntegrationState extends State<RazorPayIntegration> {
  late Razorpay razorpay;
  final TextEditingController amountController = TextEditingController();

  @override
  void initState() {
    super.initState();
    razorpay = Razorpay();
    razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, handlePaymentSuccess);
    razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, handlePaymentError);
    razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, handleExternalWallet);
  }

  @override
  void dispose() {
    razorpay.clear();
    amountController.dispose();
    super.dispose();
  }

  void handlePaymentSuccess(PaymentSuccessResponse response) {
    Fluttertoast.showToast(msg: "Payment Successful");
    print("Payment ID: ${response.paymentId}");
  }

  void handlePaymentError(PaymentFailureResponse response) {
    Fluttertoast.showToast(msg: "Payment Failed");
    print("Error: ${response.message}");
  }

  void handleExternalWallet(ExternalWalletResponse response) {
    Fluttertoast.showToast(msg: "External Wallet Selected");
  }

  void openCheckout() {
    var options = {
      'key': 'Your-Key',
      'amount': int.parse(amountController.text) * 100, // Convert to paisa
      'name': 'Riya Tyagi',
      'description': 'Payment',
      'timeout': 300,
      'prefill': {
        'contact': '7409616828',
        'email': 'riya@razorpay.com'
      },
      'external': {
        'wallets': ['paytm']
      }
    };

    try {
      razorpay.open(options);
    } catch (e) {
      debugPrint("Error: ${e.toString()}");
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Padding(
              padding: const EdgeInsets.all(20.0),
              child: TextField(
                controller: amountController,
                keyboardType: TextInputType.number,
                decoration: const InputDecoration(
                  hintText: "Enter the amount you want to pay",
                ),
              ),
            ),
            const SizedBox(height: 50),
            ElevatedButton(
              onPressed: openCheckout,
              child: const Text("Pay Now"),
            ),
          ],
        ),
      ),
    );
  }
}

UI Note

The above screen layout includes a basic text input field and a “Pay Now” button. You can further enhance the UI with animations, themes, or validation logic to give it a more polished look and feel.

This application will consist of two Dart files: main.dart and razorpay.dart.
First, follow all the integration steps outlined above, and then use the following code to implement and run the Razorpay payment process in your Flutter app.

#main.dart

import 'package:flutter/material.dart';
import 'package:razorpay/razorpay.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Razorpay Integration',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const RazorPayIntegration(),
    );
  }
}
razorpay.dart

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:razorpay_flutter/razorpay_flutter.dart';

class RazorPayIntegration extends StatefulWidget {
  const RazorPayIntegration({Key? key}) : super(key: key);

  @override
  _RazorPayIntegrationState createState() => _RazorPayIntegrationState();
}

class _RazorPayIntegrationState extends State<RazorPayIntegration> {
  late Razorpay razorpay;
  final TextEditingController amountController = TextEditingController();

  @override
  void initState() {
    super.initState();
    razorpay = Razorpay();
    razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, handlePaymentSuccess);
    razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, handlePaymentError);
    razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, handleExternalWallet);
  }

  @override
  void dispose() {
    razorpay.clear();
    amountController.dispose();
    super.dispose();
  }

  void handlePaymentSuccess(PaymentSuccessResponse response) {
    Fluttertoast.showToast(msg: "Payment Successful");
    print("Payment ID: ${response.paymentId}");
  }

  void handlePaymentError(PaymentFailureResponse response) {
    Fluttertoast.showToast(msg: "Payment Failed");
    print("Error: ${response.message}");
  }

  void handleExternalWallet(ExternalWalletResponse response) {
    Fluttertoast.showToast(msg: "External Wallet Selected");
  }

  void openCheckout() {
    var options = {
      'key': 'Your-Key',
      'amount': int.parse(amountController.text) * 100, // Convert to paisa
      'name': 'Riya Tyagi',
      'description': 'Payment',
      'timeout': 300,
      'prefill': {
        'contact': '7409616828',
        'email': 'riya@razorpay.com'
      },
      'external': {
        'wallets': ['paytm']
      }
    };

    try {
      razorpay.open(options);
    } catch (e) {
      debugPrint("Error: ${e.toString()}");
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Padding(
              padding: const EdgeInsets.all(20.0),
              child: TextField(
                controller: amountController,
                keyboardType: TextInputType.number,
                decoration: const InputDecoration(
                  hintText: "Enter the amount you want to pay",
                ),
              ),
            ),
            const SizedBox(height: 50),
            ElevatedButton(
              onPressed: openCheckout,
              child: const Text("Pay Now"),
            ),
          ],
        ),
      ),
    );
  }
}

UI Note

The above screen layout includes a basic text input field and a “Pay Now” button. You can further enhance the UI with animations, themes, or validation logic to give it a more polished look and feel.

This application will consist of two Dart files: main.dart and razorpay.dart.
First, follow all the integration steps outlined above, and then use the following code to implement and run the Razorpay payment process in your Flutter app.

#main.dart

import 'package:flutter/material.dart';
import 'package:razorpay/razorpay.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Razorpay Integration',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const RazorPayIntegration(),
    );
  }
}
razorpay.dart

import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:razorpay_flutter/razorpay_flutter.dart';

class RazorPayIntegration extends StatefulWidget {
  const RazorPayIntegration({Key? key}) : super(key: key);

  @override
  _RazorPayIntegrationState createState() => _RazorPayIntegrationState();
}

class _RazorPayIntegrationState extends State<RazorPayIntegration> {
  late Razorpay razorpay;
  final TextEditingController amountController = TextEditingController();

  @override
  void initState() {
    super.initState();
    razorpay = Razorpay();
    razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, handlePaymentSuccess);
    razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, handlePaymentError);
    razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET, handleExternalWallet);
  }

  @override
  void dispose() {
    razorpay.clear();
    amountController.dispose();
    super.dispose();
  }

  void handlePaymentSuccess(PaymentSuccessResponse response) {
    Fluttertoast.showToast(msg: "Payment Successful");
    print("Payment ID: ${response.paymentId}");
  }

  void handlePaymentError(PaymentFailureResponse response) {
    Fluttertoast.showToast(msg: "Payment Failed");
    print("Error: ${response.message}");
  }

  void handleExternalWallet(ExternalWalletResponse response) {
    Fluttertoast.showToast(msg: "External Wallet Selected");
  }

  void openCheckout() {
    var options = {
      'key': 'Your-Key',
      'amount': int.parse(amountController.text) * 100, // Convert to paisa
      'name': 'Riya Tyagi',
      'description': 'Payment',
      'timeout': 300,
      'prefill': {
        'contact': '7409616828',
        'email': 'riya@razorpay.com'
      },
      'external': {
        'wallets': ['paytm']
      }
    };

    try {
      razorpay.open(options);
    } catch (e) {
      debugPrint("Error: ${e.toString()}");
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Padding(
              padding: const EdgeInsets.all(20.0),
              child: TextField(
                controller: amountController,
                keyboardType: TextInputType.number,
                decoration: const InputDecoration(
                  hintText: "Enter the amount you want to pay",
                ),
              ),
            ),
            const SizedBox(height: 50),
            ElevatedButton(
              onPressed: openCheckout,
              child: const Text("Pay Now"),
            ),
          ],
        ),
      ),
    );
  }
}

UI Note

The above screen layout includes a basic text input field and a “Pay Now” button. You can further enhance the UI with animations, themes, or validation logic to give it a more polished look and feel.

Advanced Features and Customizations

Advanced Features and Customizations

Advanced Features and Customizations

Advanced Features and Customizations

Razorpay offers several powerful features and customization options to enhance user experience and streamline payment processing. Here are some key capabilities you can explore:

  • Custom UI Styling
    Customize the payment interface with your app’s theme—apply your brand’s colors, fonts, and logos to create a consistent user experience.

  • Payment Capture & Webhooks
    Choose between automatic and manual payment capture. You can also use webhooks to handle asynchronous payment updates, such as confirmations and failures.

  • Flexible Payment Methods
    Razorpay supports cards, UPI, net banking, wallets, and more. You can enable/disable specific options using the method parameter in the options map.

  • Subscriptions & Recurring Payments
    Leverage Razorpay’s APIs to create and manage subscription plans or handle recurring billing for services or products.

  • Add Transaction Metadata
    Use the notes parameter in the options map to include custom fields or contextual data with each payment request.

  • International Payments
    Accept payments globally by setting the appropriate currency and enabling international cards in your Razorpay dashboard.

  • Signature Verification
    Ensure payment authenticity using the verifyPaymentSignature method. This helps verify that the payment response hasn’t been altered.

For more details and use cases, refer to the official Razorpay API Documentation.

Razorpay offers several powerful features and customization options to enhance user experience and streamline payment processing. Here are some key capabilities you can explore:

  • Custom UI Styling
    Customize the payment interface with your app’s theme—apply your brand’s colors, fonts, and logos to create a consistent user experience.

  • Payment Capture & Webhooks
    Choose between automatic and manual payment capture. You can also use webhooks to handle asynchronous payment updates, such as confirmations and failures.

  • Flexible Payment Methods
    Razorpay supports cards, UPI, net banking, wallets, and more. You can enable/disable specific options using the method parameter in the options map.

  • Subscriptions & Recurring Payments
    Leverage Razorpay’s APIs to create and manage subscription plans or handle recurring billing for services or products.

  • Add Transaction Metadata
    Use the notes parameter in the options map to include custom fields or contextual data with each payment request.

  • International Payments
    Accept payments globally by setting the appropriate currency and enabling international cards in your Razorpay dashboard.

  • Signature Verification
    Ensure payment authenticity using the verifyPaymentSignature method. This helps verify that the payment response hasn’t been altered.

For more details and use cases, refer to the official Razorpay API Documentation.

Razorpay offers several powerful features and customization options to enhance user experience and streamline payment processing. Here are some key capabilities you can explore:

  • Custom UI Styling
    Customize the payment interface with your app’s theme—apply your brand’s colors, fonts, and logos to create a consistent user experience.

  • Payment Capture & Webhooks
    Choose between automatic and manual payment capture. You can also use webhooks to handle asynchronous payment updates, such as confirmations and failures.

  • Flexible Payment Methods
    Razorpay supports cards, UPI, net banking, wallets, and more. You can enable/disable specific options using the method parameter in the options map.

  • Subscriptions & Recurring Payments
    Leverage Razorpay’s APIs to create and manage subscription plans or handle recurring billing for services or products.

  • Add Transaction Metadata
    Use the notes parameter in the options map to include custom fields or contextual data with each payment request.

  • International Payments
    Accept payments globally by setting the appropriate currency and enabling international cards in your Razorpay dashboard.

  • Signature Verification
    Ensure payment authenticity using the verifyPaymentSignature method. This helps verify that the payment response hasn’t been altered.

For more details and use cases, refer to the official Razorpay API Documentation.

Razorpay offers several powerful features and customization options to enhance user experience and streamline payment processing. Here are some key capabilities you can explore:

  • Custom UI Styling
    Customize the payment interface with your app’s theme—apply your brand’s colors, fonts, and logos to create a consistent user experience.

  • Payment Capture & Webhooks
    Choose between automatic and manual payment capture. You can also use webhooks to handle asynchronous payment updates, such as confirmations and failures.

  • Flexible Payment Methods
    Razorpay supports cards, UPI, net banking, wallets, and more. You can enable/disable specific options using the method parameter in the options map.

  • Subscriptions & Recurring Payments
    Leverage Razorpay’s APIs to create and manage subscription plans or handle recurring billing for services or products.

  • Add Transaction Metadata
    Use the notes parameter in the options map to include custom fields or contextual data with each payment request.

  • International Payments
    Accept payments globally by setting the appropriate currency and enabling international cards in your Razorpay dashboard.

  • Signature Verification
    Ensure payment authenticity using the verifyPaymentSignature method. This helps verify that the payment response hasn’t been altered.

For more details and use cases, refer to the official Razorpay API Documentation.

Conclusion

Conclusion

Conclusion

Conclusion

Razorpay is a powerful and developer-friendly payment gateway that allows seamless integration of online transactions within Flutter applications.

To use Razorpay, you must create an account and access your API Key from the Razorpay Dashboard. This key is essential for initializing the payment process in your app.

Razorpay supports multiple payment methods, including Credit/Debit Cards, Net Banking, UPI, and wallets. The platform also allows UI customization, such as theme colors, logos, and preferred languages, to match your app’s design and branding.

You can handle events such as payment success, failure, and external wallet selection using Razorpay's event listeners. For cancellations, Razorpay emits the onCancel event, which you can use to gracefully handle user exits.

The razorpay_flutter Making the entire integration process straightforward. Just remember to update platform-specific configurations for both Android and iOS, and securely paste your API Key where needed.

With these steps, your Flutter application is ready to accept payments securely and efficiently using Razorpay.

✅ Ready to Power Up Your Flutter App with Payments?

You've now learned how to integrate Razorpay into your Flutter app, from setup to customization and real-time payment handling.

If you're building real-world projects and want to master Flutter with Payments, Firebase, API calls, and Production-ready UI, explore our complete Flutter course.

🎯 Learn by Building | 🚀 Mentor-Led Projects | 💼 Job-Focused Curriculum

👉 Join the Flutter App Development Course at Coding Blocks

Razorpay is a powerful and developer-friendly payment gateway that allows seamless integration of online transactions within Flutter applications.

To use Razorpay, you must create an account and access your API Key from the Razorpay Dashboard. This key is essential for initializing the payment process in your app.

Razorpay supports multiple payment methods, including Credit/Debit Cards, Net Banking, UPI, and wallets. The platform also allows UI customization, such as theme colors, logos, and preferred languages, to match your app’s design and branding.

You can handle events such as payment success, failure, and external wallet selection using Razorpay's event listeners. For cancellations, Razorpay emits the onCancel event, which you can use to gracefully handle user exits.

The razorpay_flutter Making the entire integration process straightforward. Just remember to update platform-specific configurations for both Android and iOS, and securely paste your API Key where needed.

With these steps, your Flutter application is ready to accept payments securely and efficiently using Razorpay.

✅ Ready to Power Up Your Flutter App with Payments?

You've now learned how to integrate Razorpay into your Flutter app, from setup to customization and real-time payment handling.

If you're building real-world projects and want to master Flutter with Payments, Firebase, API calls, and Production-ready UI, explore our complete Flutter course.

🎯 Learn by Building | 🚀 Mentor-Led Projects | 💼 Job-Focused Curriculum

👉 Join the Flutter App Development Course at Coding Blocks

Razorpay is a powerful and developer-friendly payment gateway that allows seamless integration of online transactions within Flutter applications.

To use Razorpay, you must create an account and access your API Key from the Razorpay Dashboard. This key is essential for initializing the payment process in your app.

Razorpay supports multiple payment methods, including Credit/Debit Cards, Net Banking, UPI, and wallets. The platform also allows UI customization, such as theme colors, logos, and preferred languages, to match your app’s design and branding.

You can handle events such as payment success, failure, and external wallet selection using Razorpay's event listeners. For cancellations, Razorpay emits the onCancel event, which you can use to gracefully handle user exits.

The razorpay_flutter Making the entire integration process straightforward. Just remember to update platform-specific configurations for both Android and iOS, and securely paste your API Key where needed.

With these steps, your Flutter application is ready to accept payments securely and efficiently using Razorpay.

✅ Ready to Power Up Your Flutter App with Payments?

You've now learned how to integrate Razorpay into your Flutter app, from setup to customization and real-time payment handling.

If you're building real-world projects and want to master Flutter with Payments, Firebase, API calls, and Production-ready UI, explore our complete Flutter course.

🎯 Learn by Building | 🚀 Mentor-Led Projects | 💼 Job-Focused Curriculum

👉 Join the Flutter App Development Course at Coding Blocks

Razorpay is a powerful and developer-friendly payment gateway that allows seamless integration of online transactions within Flutter applications.

To use Razorpay, you must create an account and access your API Key from the Razorpay Dashboard. This key is essential for initializing the payment process in your app.

Razorpay supports multiple payment methods, including Credit/Debit Cards, Net Banking, UPI, and wallets. The platform also allows UI customization, such as theme colors, logos, and preferred languages, to match your app’s design and branding.

You can handle events such as payment success, failure, and external wallet selection using Razorpay's event listeners. For cancellations, Razorpay emits the onCancel event, which you can use to gracefully handle user exits.

The razorpay_flutter Making the entire integration process straightforward. Just remember to update platform-specific configurations for both Android and iOS, and securely paste your API Key where needed.

With these steps, your Flutter application is ready to accept payments securely and efficiently using Razorpay.

✅ Ready to Power Up Your Flutter App with Payments?

You've now learned how to integrate Razorpay into your Flutter app, from setup to customization and real-time payment handling.

If you're building real-world projects and want to master Flutter with Payments, Firebase, API calls, and Production-ready UI, explore our complete Flutter course.

🎯 Learn by Building | 🚀 Mentor-Led Projects | 💼 Job-Focused Curriculum

👉 Join the Flutter App Development Course at Coding Blocks