【问题标题】:How to generate Live hash key for PayUMoney android如何为 PayUMoney android 生成实时哈希密钥
【发布时间】:2017-08-09 09:52:15
【问题描述】:

我正在尝试将 PayUmoney android SDK 集成到我的应用程序中,我成功集成但我面临一个问题。

在测试模式下,他们提供 url 来生成 hask 密钥,但他们不会提供现场直播

测试模式:https://test.payumoney.com/payment/op/calculateHashForTest

对于实时模式:???

i am trying below Code to generate  Live Hash key 

   String salt="saltkey";
            String hashSequence=key+"|"+txnid+"|"+amount+"|"+productinfo+"|"

+firstname+"|"+email+"|"+""+"|"+"|"+""+"|"+""+"|"+""+"|"+salt;

            String serverCalculatedHash= hashCal("SHA-512", hashSequence);
            paymentParam.setMerchantHash(serverCalculatedHash);
            PayUmoneySdkInitilizer.startPaymentActivityForResult((Activity) 
context, paymentParam);  

  BUt i got  below response from sdk

 {"status":-1,"message":"key is not valid","result":null,"errorCode":null,"responseCode":null}

{"status":-1,"message":"payment status for :1111322345","result":"PP1 not updated till now from P2","errorCode":null,"responseCode":null}


 please give solution to:
1. generate live hash key using url,  
2.why above mention response return from PayUMoney SDk

Expecting your valuble answer.

【问题讨论】:

    标签: android payumoney


    【解决方案1】:

    您可以使用此功能为 PayUMoney android 生成 Live hash key

     public static String hashCal(String type, String str) {
            byte[] hashseq = str.getBytes();
            StringBuffer hexString = new StringBuffer();
            try {
                MessageDigest algorithm = MessageDigest.getInstance(type);
                algorithm.reset();
                algorithm.update(hashseq);
                byte messageDigest[] = algorithm.digest();
                for (int i = 0; i<messageDigest.length; i++) {
                    String hex = Integer.toHexString(0xFF &messageDigest[i]);
                    if (hex.length() == 1) {
                        hexString.append("0");
                    }
                    hexString.append(hex);
                }
            } catch (NoSuchAlgorithmException nsae) {
    
            }
            return hexString.toString();
        }
    

    然后像这样调用

      String serverCalculatedHash = hashCal("SHA-512",MERCHANT_KEY+"|"+txnId+"|"+Double.parseDouble(totalPrices)+"|"+productName+"|"
                    +userName+"|"+userEmail+"|"+udf1+"|"+udf2+"|"+udf3+"|"+udf4+"|"+udf5+"|"+MERCHANT_SALT);
    

    serverCalculatedHash 包含 PayUMoney 的哈希键

    【讨论】:

    • 我会尽力让你知道
    【解决方案2】:

    在 Integration Credentials 中查看您的 payu 仪表板:Merchant Key 和 Merchant Salt 将可用。

    还要检查 .setIsDebug(true) // 对于集成环境 - true,对于生产 - false。

    您指定了 Hash 字符串 hashSequence=key+"|"+txnid+"|"+amount+"|"+productinfo+"|"+firstname+"|"+email+"|"+""+"|"+"|"+""+"|" +""+"|"+""+"|"+盐;

    应该是:

    hashSequence=key+"|"+txnid+"|"+amount+"|"+productinfo+"|"+名字+"|"+email+"|"+udf1+"|"+udf2+"|"+udf3+"|"+ udf4+"|"+udf5+"|"+udf6+"|"+udf7+"|"+udf8+"|"+udf9+"|"+udf10+"|"+salt;

    用户定义的字符串可以为空,但必须以哈希顺序传递。

    【讨论】:

      猜你喜欢
      • 2013-10-21
      • 2013-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-28
      • 2011-10-03
      • 2012-12-16
      • 1970-01-01
      相关资源
      最近更新 更多