2017-07-01 107 views
0

我已通过官方文档在 https://www.payumoney.com/dev-guide/mobilecheckout/android.html#prereq中将payu集成到我的Android应用程序中。Payu payement错误“发生了一些错误,请再试一次!”

我面临的问题是,我的代码完全符合测试凭证,并且当我使用我想要在应用程序中集成的真实帐户的凭据时失败。

public void makePayment(View view) { 
    String phone = "8882434664"; 
    String productName = "product_name"; 
    String firstName = "piyush"; 
    String txnId = "0nf7" + System.currentTimeMillis(); 
    String email = "[email protected]"; 
    String sUrl = "https://test.payumoney.com/mobileapp/payumoney/success.php"; 
    String fUrl = "https://test.payumoney.com/mobileapp/payumoney/failure.php"; 
    String udf1 = ""; 
    String udf2 = ""; 
    String udf3 = ""; 
    String udf4 = ""; 
    String udf5 = ""; 
    boolean isDebug = true; 

    String key = "2fcU3pmI"; 
    String merchantId = "4947182";// These credentials are from https://test.payumoney.com/ 
    String salt = "BxA24L2F7Z"; // THIS WORKS 

    /* String key = "yX8OvWy1";  //These credentials are from https://www.payumoney.com/ 
    String merchantId = "5826688"; //THIS DOESN'T WORK 
    String salt = "0vciMJBbaa"; //ERROR: "some error occurred, Try again" 
    */ 

    PayUmoneySdkInitilizer.PaymentParam.Builder builder = new PayUmoneySdkInitilizer.PaymentParam.Builder(); 


    builder.setAmount(getAmount()) 
      .setTnxId(txnId) 
      .setPhone(phone) 
      .setProductName(productName) 
      .setFirstName(firstName) 
      .setEmail(email) 
      .setsUrl(sUrl) 
      .setfUrl(fUrl) 
      .setUdf1(udf1) 
      .setUdf2(udf2) 
      .setUdf3(udf3) 
      .setUdf4(udf4) 
      .setUdf5(udf5) 
      .setIsDebug(isDebug) //Also can someone clarify if this should be true/false for live mode 
      .setKey(key) 
      .setMerchantId(merchantId); 

    PayUmoneySdkInitilizer.PaymentParam paymentParam = builder.build(); 


    String hash = hashCal(key + "|" + txnId + "|" + getAmount() + "|" + productName + "|" 
      + firstName + "|" + email + "|" + udf1 + "|" + udf2 + "|" + udf3 + "|" + udf4 + "|" + udf5 + "|" + salt); 
    Log.d("app_activity123", hash); 
    paymentParam.setMerchantHash(hash); 

    PayUmoneySdkInitilizer.startPaymentActivityForResult(MyActivity.this, paymentParam); 

} 

额外的信息:测试证书最初并未工作。我必须联系payu支持团队来激活帐户,然后代码工作正常。我的雇主说他已经启动了真实账户,所以我不知道这里有什么问题。

在这里没有其他的问题,最近的一个在这里PayuMoney Integration in Android : Some error occured! Try again,它是没有答案。

回答

0

setIsDebug(boolean)您需要在此方法中传递false作为参数以使用实时付款,并且在实时模式下进行测试时为true。 我将它设置为false,并使用Real Merchant ID,salt和key,它工作,没有错误。 希望这可以帮助别人。

0

我觉得你的问题是在该行

'PayUmoneySdkInitilizer.startPaymentActivityForResult(MyActivity.this, paymentParam);'. 

,你必须使用

'PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam,this, R.style.AppTheme_default, false);' 
0

调试到PayUmoneyActivity 错误响应启动交易的正式文件状态包含实际的错误。 它可能是散列不匹配或错误的键。

@override 
public void onFailureResponse(ErrorResponse response, String tag) { 
mProgressDialog.dismiss(); 
Toast.makeText(context, "Some error occured", 
Toast.LENGTH_SHORT).show(); 
finish(); 
} 

PayUmoneyActivity中的此方法不会显示错误响应中的错误。只是一般的错误。这对调试非常有问题。

相关问题