Troubleshooting & FAQs
Troubleshoot common error scenarios and find answers to frequently asked questions.
If you are using
, you can use this code sample to fetch the subscription details:JSONObject options = new JSONObject();options.put("subscription_id", subscription_id);razorpay.getPaymentMethods(options, new PaymentMethodsCallback() {@Overridepublic void onPaymentMethodsReceived(String result) {JSONObject paymentMethods = new JSONObject(result);}@Overridepublic void onError(String error){}});});
If you are using
, you can fetch the subscription amount by calling thegetSubscriptionAmount
method.
razorpay.getSubscriptionAmount("sub_id", new SubscriptionAmountCallback() {@Overridepublic void onSubscriptionAmountReceived(long amount) {}@Overridepublic void onError(String error) {}});
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 Razorpay Dashboard.
/*** In your activity, you need to override onBackPressed*/@Overridepublic void onBackPressed() {if(razorpay != null){razorpay.onBackPressed();}super.onBackPressed();}
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.
/*** change the API key*/razorpay.changeMerchantKey("YOUR_KEY_ID");
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
to the latest SDK version.To check the SDK version:
- Open your Android project in Android Studio.
- Navigate to the
build.gradle
file of your app module (usuallyapp/build.gradle
). - Locate the
dependencies
block in the file. - Find the line that includes the Razorpay SDK dependency. The version number will be alongside the SDK name in the format
x.y.z
.dependencies {implementation 'com.razorpay:customui:3.9.22'}
To update the Custom Android SDK, follow these steps:
- Check the .
- In the app-level gradle build file, update the SDK version to the latest release.
dependencies {// … other dependencies// For Razorpay checkout SDKimplementation ‘com.razorpay:customui:<latest-version-name-goes-here>‘// … other dependencies}
- After updating, sync gradle and check for any compile-time errors.
- Ensure all changes are correctly integrated and the application functions as expected.
Handy Tips
From version 3.9.22 onwards, the latest version is automatically updated, eliminating the need for manual updates.
Is this integration guide useful?
ON THIS PAGE