Integrate with Turbo UPI

Steps to integrate Razorpay Turbo UPI with your app.


With Razorpay Turbo UPI, businesses experience faster and simpler payments. It condenses the payment process from 5 steps to just 1, eliminating app redirections. Enjoy a seamless in-app payment experience, reduce dependencies on third-party UPI apps, and gain complete visibility of the payment journey.

You can seamlessly integrate Turbo UPI with Razorpay Flutter Standard SDK. Explore the full potential of

and know How it Works.

Watch Out!

Currently, Flutter SDK is supported only for Android.

Turbo UPI Standard Checkout Flow

Prerequisites

  1. Contact our

    to get your mobile number, app, and GitHub account whitelisted to get access to the https://github.com/upi-turbo/razorpay-turbo-flutter - sample app repository. In this repository, you will find the AAR files (libraries for Turbo). The AARs on the main branch are for the UAT environment, and the ones on the prod branch are for the production environment.
    These are the important files in the sample app repo:

    • android/app/libs: All libraries (Bank, SecureComponent and Turbo). Know more about .
    • android/app/uiLibrary: Library for Turbo UI SDK.
    • android/app/build.gradle: All transitive dependencies needed to integrate Turbo SDK.
  2. Integrate with

    .

  3. Import the following frameworks:

    • Razorpay Android Standard SDK
    • Razorpay Turbo Wrapper Plugin SDK (maven)
    • Razorpay Turbo Core SDK
    • Razorpay Turbo UI SDK
    • Razorpay SecureComponent SDK
    • Bank SDK
  4. Add the following lines to your Android project's gradle.properties file:

    • android.enableJetifier=true
    • android.useAndroidX=true

Library Dependencies

Integrating library files is necessary to proceed with Turbo integration. Follow these steps to integrate library dependencies:

  1. Navigate to your Flutter project's directory and locate the android folder. Find the src folder inside android and create a new libs folder.

  2. Copy all your library files into the newly created libs folder.

  3. Open the build.gradle file in the app directory of your Flutter project. Add an implementation reference to the library files you added in the libs folder.

    implementation fileTree(include: ['*.aar'], dir: 'libs')
  4. Update the dependencies section in your project's pubspec.yaml file to include the libraries you added. Ensure the references point to the correct location, usually master.

    razorpay_flutter:
    git:
    url: https://github.com/razorpay/razorpay-flutter.git
    ref: master # branch name
  5. Run flutter pub get in your terminal to ensure the dependencies are properly resolved and downloaded.

  6. Navigate to the build.gradle file in the android directory of the razorpay-flutter plugin module. Add a compile only statement to include the necessary libraries for compilation.

    compileOnly fileTree(include: ['*.aar'], dir: '/.../razorpay-turbo-flutter/android/app/libs') // Add absolute path of libs folder

Ensure your customers

to get started.

Follow these steps to integrate with Razorpay Turbo UPI:

  1. Use the code given below to initialise the SDK.

    import 'package:razorpay_flutter/razorpay_flutter.dart';
    // Create a Razorpay instance
    razorpay = Razorpay("YOUR_KEY_ID").initUpiTurbo();
  2. Use the following code to link the newly created UPI account with your app. This function can be called from anywhere in the application, providing multiple entry points for customers to link their UPI account with your app.

    Request Parameters

    mobileNumber

    mandatory

    string Mobile number of the customer.

    color

    optional

    string Colour in hex format.

    Response Parameters

    ParametersDescription
    onSuccessThis function is triggered if the list is fetched successfully. upiAccounts can be empty to indicate that no accounts have been linked yet.
    onFailureThis function is triggered in case of an error, and the error object will be received.
    • Initialise the instance to handle the event using the code given below:
    razorpay.on(Razorpay.EVENT_PAYMENT_ERROR, handlePaymentErrorResponse);
    razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS, handlePaymentSuccessResponse);
    • Handle payment failure responses, displaying important details such as error codes, error descriptions, and metadata. This function is responsible for handling and logging information in the event of a payment error.
    void handlePaymentErrorResponse(PaymentFailureResponse response) {
    /**
    * PaymentFailureResponse contains three values:
    * 1. Error Code
    * 2. Error Description
    * 3. Metadata
    **/
    print('Payment Error Response : $response');
    }
    • Handle successful payment responses, displaying key information like order ID, payment ID, and signature. This code manages and logs details when a payment transaction is successful.
    void handlePaymentSuccessResponse(PaymentSuccessResponse response) {
    /**
    * Payment Success Response contains three values:
    * 1. Order ID
    * 2. Payment ID
    * 3. Signature
    **/
    print('Payment Success Response : $response');
    }
  3. To accept payments, call Standard Checkout’s submit method with the following payload:

    Map<String, Object> payload = {
    'amount': 100
    'currency': 'INR',
    'prefill':{
    'contact':'8888888888',
    'email':'test@razorpay.com'
    },
    'theme':{
    'color':'#0CA72F'
    },
    'send_sms_hash':true,
    'retry':{
    'enabled':false,
    'max_count':4
    },
    'key': '$merchantKey',
    'disable_redesign_v15': false,
    'experiments.upi_turbo':true
    };
    razorpay.open(payload);

    Request Parameter

    payload

    mandatory

    Map<String, dynamic> Payload for initiating transaction.

Razorpay provides a single exposed function that allows you to manage linked UPI accounts and access all non-transactional flows seamlessly.

View the non-transactional flow

Manage UPI Accounts

The SDK manages the linked UpiAccounts on the application by triggering manageUpiAccounts(). The sequence of steps is as given below:

  • Fetch balance: Check the customer's account balance.
  • Change UPI PIN: Provide the customer the ability to change their UPI PIN.
  • Reset UPI PIN: Let your customers reset the PIN for their account.
  • Delete the account from the application: Let your customers delink, that is, remove a selected UPI account from your application.
razorpay.upiTurbo.manageUpiAccounts(customerMobile: mobileNumberValue,
color: "#ffffff",
onFailure:(Error error) {
}
);

Request Parameters

customerMobile

mandatory

string Mobile number of the customer.

color

optional

string Colour in hex format.

Response Parameter

ParametersDescription
onFailureThis function is triggered in case of an error, and the error object will be received.

The SDKs given below provide access to exposed models for seamless integration.

Error

ErrorDescription
errorCodeTypes of error codes
  • BAD_REQUEST_ERROR: Failure from the client's end (SDK).
  • GATEWAY_ERROR: Failure either from the Secure Component or the Bank.
  • SERVER_ERROR: Failure at PSP.
errorDescriptionBrief description of the error.
errorReasonSpecifies the specific reason for the error.
errorSourceIndicates the origin of the error.
errorStepHighlights the stage where the error occurred.

[This is the latest version of the list and was last updated on February 27th, 2024]

UpiAccount

FieldsReturn TypeDescription
accountNumberStringMasked account number.
ifscStringIFSC of the bank.
bankLogoUrlStringImage URL of the bank logo.
bankNameStringName of the bank.
bankPlaceholderUrlStringImage URL of the bank logo placeholder.

Is this integration guide useful?


integrate flutter sdk
turbo upi
onboarding flow
non transactional flow