Issue
I'm implementing the Standard Android Razorpay SDK.
Below image is the default payment options provided by Razorpay
I wanted to remove 3 payment options and they are Paylater, Wallet and EMI. After adding the below codes
Checkout checkout = new Checkout();
checkout.setKeyID(keyId);
checkout.setImage(R.drawable.isthmus_logo);
try {
JSONObject orderRequest = new JSONObject();
JSONObject configObj = new JSONObject();
JSONObject displayObj = new JSONObject();
JSONArray hideObj = new JSONArray();
JSONObject methodObj = new JSONObject();
JSONObject methodObj2 = new JSONObject();
JSONObject methodObj3 = new JSONObject();
JSONObject preferencesObj = new JSONObject();
preferencesObj.put("show_default_blocks", "true");
methodObj.put("method", "wallet");
methodObj2.put("method", "paylater");
methodObj3.put("method", "emi");
hideObj.put(methodObj);
hideObj.put(methodObj2);
hideObj.put(methodObj3);
displayObj.put("hide", hideObj);
displayObj.put("preferences", preferencesObj);
configObj.put("display", displayObj);
orderRequest.put("name", "Isthmus Business");
orderRequest.put("amount", subOrderAmount);
orderRequest.put("currency", "INR");
if (razorOrderId != null) {
orderRequest.put("order_id", razorOrderId);
}
orderRequest.put("config", configObj);
Log.i(TAG, orderRequest.toString());
checkout.open(getParentFragment().getActivity(), orderRequest);
} catch (Exception e) {
Log.w(TAG, e.getMessage());
}
as you can see , the EMI option is still there but I successfully remove Paylater and Wallet , I have played with some code and I was able to remove all payment options except for EMI .
I have also question this error or whatever it is in Razorpay Github Repo , they still haven't answer yet . Does anyone face similar problem like I do . If you have a solution please help me out .
Solution
Yes, the above code works like charm . The problem I mention earlier will automatically solved when you activate Live mode from Razorpay dashboard and generated the Live API keys and set the Live API keyid to the CheckOut.setKeyID(LiveKeyID) .
Answered By - JustGotStared
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.