Add the dependency
Add the Razorpay Checkout SDK to your module-levelbuild.gradle file:
build.gradle
From version 1.6.22 onwards, the SDK is written in Kotlin. Make sure the Kotlin standard library is included in your project. Most modern Android projects include it by default.
PCI compliance requirements
The Razorpay Android SDK requires TLS 1.1 or TLS 1.2 for all network communication. Devices running Android 4.0 (API level 14) and below do not support TLS 1.2 by default. If you need to support those devices, enable TLS explicitly using a customSSLSocketFactory.
Integration steps
1
Create an order on your server
Before opening checkout, create an order using the Razorpay API from your backend. Return the
order_id to your app. See the web integration guide for a server-side example — the order creation API is the same across all platforms.2
Implement the checkout in your Activity
Implement Call
PaymentResultListener in your Activity or Fragment, preload the SDK in onCreate, and open the checkout when you are ready.CheckoutActivity.kt
Checkout.preload(applicationContext) in onCreate to initialize the SDK in the background. This reduces the time to display checkout when the customer taps the payment button.3
Verify the payment signature on your server
After
onPaymentSuccess is called, send the razorpayPaymentId along with the order_id and razorpay_signature to your server for verification. Use the same signature verification logic described in the web integration guide.