Razorpay Checkout UI , removing selected payment options

Issue

I’m implementing the Standard Android Razorpay SDK.
Below image is the default payment options provided by Razorpay
enter image description here

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());
        }

Below image is the result
enter image description here

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

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published