Skip to main content
Available in🇮🇳 India
You can use the onBackPressed method to handle a situation where the customer has pressed the Back button before completing the payment. This marks the payment as failed on the Dashboard.
onBackPressed Method
You can change API keys after you have already initialized the Razorpay object by calling razorpay.changeMerchantKey(merchantKey). This is an optional method that overrides the existing API key. The new key is used for authenticating the requests sent to Razorpay.
API Key Change
To check the SDK version:
  1. Open your Android project in Android Studio.
  2. Navigate to the build.gradle file of your app module (usually app/build.gradle).
  3. Locate the dependencies block in the file.
  4. Find the line that includes the Razorpay SDK dependency. The version number will be alongside the SDK name in the formatx.y.z.
build.gradle
To update the Custom Android SDK, follow these steps:
  1. Check the latest SDK version.
  2. In the app-level gradle build file, update the SDK version to the latest release.
Update SDK
  1. After updating, sync gradle and check for any compile-time errors.
  2. Ensure all changes are correctly integrated and the application functions as expected.
Handy TipsFrom version 3.9.22 onwards, the latest version is automatically updated, eliminating the need for manual updates.
This error appeared due to an intent redirection issue that was present in the older versions of the Razorpay Android Custom SDK. To resolve this, please upgrade to the latest SDK version.
If you are using Subscriptions, you can use this code sample to fetch the subscription details:
Fetch Subscription
If you are using Subscriptions, you can fetch the subscription amount by calling the getSubscriptionAmount method.
Fetch Subscription Amount