Android SDK - Custom UI

The Android SDK allows you to customize the default Razorpay checkout for your site/app. With this SDK, you can:

  1. Create a custom checkout interface for accepting payments from different methods such as cards, net banking or wallets.
  2. Validate the customer inputs such as card number, expiry date and others using algorithms such as luhn check.
  3. Add or remove payment methods.

It is recommended that you familiarize yourself with the Razorpay payment lifecycle in order to integrate correctly.

For simpler integration, use our basic Android SDK that contains the default Razorpay Checkout.

TLS Changes:
According to PCI regulations, payment processing is not allowed on TLSv1. So in case the device does not have TLS 1.1 or TLS 1.2, the SDK returns an error in the onPaymentError method.


  • Card utilities added
  • Support added to fetch logo URL for banks and wallets

Checkout Flow#

Use this SDK to facilitate payments in following manner:

  1. Merchant displays the payment collection page to the customer.
  2. The customer enters payment details and clicks Pay.
  3. Merchant creates a webview and passes the payment details to Razorpay.
  4. Payment processing is handled by Razorpay.
  5. Once the payment is complete, Razorpay hands over the control to the merchant.


Follow the below steps to install the SDK in your Android project:

  1. Download the latest version of the Android SDK and place the razorpay-android-3.8.3.aar file inside the libs folder.

  2. Add the below code to your project's top-level build.gradle file:

Copyallprojects { repositories { jcenter() flatDir { dirs 'libs' } } }

This will you give access to the SDK library.

  1. Add the following lines of code to your app's build.gradle file:
Copydependencies { compile project(name: "razorpay-android-3.8.3", ext: 'aar') }

This will add the dependencies for the SDK.


You can add your Razorpay API key to AndroidManifest.xml. To set your API key programmatically, refer to the usage section..

The sample AndroidManifest.xml file with auto-OTP reading feature enabled is shown below:

Copy<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=""> <application> <meta-data android:name="com.razorpay.ApiKey" android:value="YOUR_API_KEY" /> </application> </manifest>

Override min SDK version#

The SDK min version is 19, so the app should have minSDK version 19 or higher. If you want to support the devices below API level 19, then you may override minSDK version. See below code for the example:

Copy<uses-sdk android:targetSdkVersion="27" android:minSdkVersion="14" tools:overrideLibrary="com.razorpay"/>

Proguard Rules#

If you are using proguard for your builds, you need to add the following lines to your proguard file:

Copy-keepclassmembers class * { @android.webkit.JavascriptInterface <methods>; } -keepattributes JavascriptInterface -keepattributes *Annotation* -dontwarn com.razorpay.** -keep class com.razorpay.** {*;} -optimizations !method/inlining/* -keepclasseswithmembers class * { public void onPayment*(...); }