简体   繁体   English

Razorpay Checkout UI,删除选定的付款选项

[英]Razorpay Checkout UI , removing selected payment options

I'm implementing the Standard Android Razorpay SDK .我正在实施标准 Android Razorpay SDK
Below image is the default payment options provided by Razorpay下图是 Razorpay 提供的默认付款方式在此处输入图像描述

I wanted to remove 3 payment options and they are Paylater , Wallet and EMI .我想删除 3 个付款选项,它们是PaylaterWalletEMI 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下图是结果在此处输入图像描述

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 .如您所见, EMI选项仍然存在,但我成功删除了 PaylaterWallet ,我使用了一些代码,并且能够删除除EMI之外的所有付款选项。
I have also question this error or whatever it is in Razorpay Github Repo , they still haven't answer yet .我也质疑这个错误或 Razorpay Github Repo 中的任何错误,他们还没有回答。 Does anyone face similar problem like I do .有没有人像我一样面临类似的问题。 If you have a solution please help me out .如果您有解决方案,请帮助我。

Yes, the above code works like charm .是的,上面的代码就像 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) .当您从 Razorpay 仪表板激活 Live 模式并生成 Live API 密钥并将 Live API keyid 设置为 CheckOut.setKeyID(LiveKeyID) 时,我前面提到的问题将自动解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM