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.
-
Contact our
to get your mobile number, app, and GitHub account whitelisted to get access to thehttps://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.
-
Integrate with
. -
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
-
Add the following lines to your Android project's
gradle.properties
file:android.enableJetifier=true
android.useAndroidX=true
Integrating library files is necessary to proceed with Turbo integration. Follow these steps to integrate library dependencies:
-
Navigate to your Flutter project's directory and locate the
android
folder. Find thesrc
folder insideandroid
and create a newlibs
folder. -
Copy all your library files into the newly created
libs
folder. -
Open the
build.gradle
file in the app directory of your Flutter project. Add an implementation reference to the library files you added in thelibs
folder.implementation fileTree(include: ['*.aar'], dir: 'libs') -
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, usuallymaster
.razorpay_flutter:git:url: https://github.com/razorpay/razorpay-flutter.gitref: master # branch name -
Run
flutter pub get
in your terminal to ensure the dependencies are properly resolved and downloaded. -
Navigate to the
build.gradle
file in theandroid
directory of therazorpay-flutter
plugin module. Add acompile 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:
-
Use the code given below to initialise the SDK.
import 'package:razorpay_flutter/razorpay_flutter.dart';// Create a Razorpay instancerazorpay = Razorpay("YOUR_KEY_ID").initUpiTurbo(); -
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.
razorpay.upiTurbo.linkNewUpiAccount(customerMobile: mobileNumber,color: "#ffffff",onSuccess: (List<UpiAccount> upiAccounts) {},onFailure:(Error error) {});mobileNumber
mandatory
string
Mobile number of the customer.color
optional
string
Colour in hex format.- 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');} -
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);
Razorpay provides a single exposed function that allows you to manage linked UPI accounts and access all non-transactional flows seamlessly.
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) {});
The SDKs given below provide access to exposed models for seamless integration.
Is this integration guide useful?