UPI App Deep linking using Intent - inconsistent and buggy behavior

前端 未结 4 981
轮回少年
轮回少年 2020-12-08 08:29

I have deeplinked UPI apps from my android native app using intent. I have tested this with various UPI apps like BHIM, PhonePe, AXIS, UnionBank, Pockets etc.

I crea

4条回答
  •  广开言路
    2020-12-08 09:14

    It really works for the BHIM application also. Use this Code it works like a charm for every PSP enabled applications.

    Note: Instead of using the "%" better to use "+" to replace the white space from the URL. That works better.

    private String getUPIString(String payeeAddress, String payeeName, String payeeMCC, String trxnID, String trxnRefId,
                                String trxnNote, String payeeAmount, String currencyCode, String refUrl) {
        String UPI = "upi://pay?pa=" + payeeAddress + "&pn=" + payeeName
                + "&mc=" + payeeMCC + "&tid=" + trxnID + "&tr=" + trxnRefId
                + "&tn=" + trxnNote + "&am=" + payeeAmount + "&cu=" + currencyCode
                + "&refUrl=" + refUrl;
        return UPI.replace(" ", "+");
    }
    

    Then pass the parameters in the method and pass the string to the Intent in this way:

    Intent intent = new Intent();
                intent.setAction(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(UPI));
                Intent chooser = Intent.createChooser(intent, "Pay with...");
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                    startActivityForResult(chooser, 1, null);
                }
    

提交回复
热议问题