如何获得payumoney支付的交易状态

时间:2017-09-17 16:19:38

标签: android paypal payment-gateway payumoney

我已将PayUMoney与我的Android应用程序集成,交易工作正常,但我没有得到任何响应数据,我必须根据支付交易的状态执行一些操作(On Success我必须执行一些操作和放大器;失败时我必须执行其他操作。)

这是我的代码

private void callPayUGateway(String toBePaid, String firstName, String mobileNo, final String emailId) {

        PayUmoneyConfig payUmoneyConfig = PayUmoneyConfig.getInstance();
        payUmoneyConfig.setDoneButtonText("Continue");
        payUmoneyConfig.setPayUmoneyActivityTitle("PayUMoney");

        String txnId = System.currentTimeMillis() + "";
        String productName = "product_name";
        String salt = "nrn0cqVgkH";
        String marchantId = "5000051";
        String marchantKey = "mJ0vrJ0Z";

        PayUmoneySdkInitializer.PaymentParam.Builder builder = new PayUmoneySdkInitializer.PaymentParam.Builder();
        builder.setAmount(Double.parseDouble(toBePaid))
                .setTxnId(txnId)
                .setPhone(mobileNo)
                .setProductName(productName)
                .setFirstName(firstName)
                .setEmail(emailId)
                .setsUrl("https://www.payumoney.com/mobileapp/payumoney/success.php")
                .setfUrl("https://www.payumoney.com/mobileapp/payumoney/failure.php")
                .setUdf1("")
                .setUdf2("")
                .setUdf3("")
                .setUdf4("")
                .setUdf5("")
                .setUdf6("")
                .setUdf7("")
                .setUdf8("")
                .setUdf9("")
                .setUdf10("")
                .setIsDebug(false)
                .setKey(marchantKey)
                .setMerchantId(marchantId);
        try {
            mPaymentParams = builder.build();

            HashMap<String, String> params = mPaymentParams.getParams();
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(params.get(PayUmoneyConstants.KEY) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.TXNID) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.AMOUNT) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.PRODUCT_INFO) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.FIRSTNAME) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.EMAIL) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.UDF1) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.UDF2) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.UDF3) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.UDF4) + "|");
            stringBuilder.append(params.get(PayUmoneyConstants.UDF5) + "||||||");
            //salt
            stringBuilder.append(salt);

            final String hash = hashCal(stringBuilder.toString());
            if (!hash.isEmpty()) {
                mPaymentParams.setMerchantHash(hash);
                if (AppConstants.selectedTheme != -1) {
                    PayUmoneyFlowManager.startPayUMoneyFlow(mPaymentParams, CheckoutActivity.this, AppConstants.selectedTheme, appConstants.isOverrideResultScreen());
                } else {
                    PayUmoneyFlowManager.startPayUMoneyFlow(mPaymentParams, CheckoutActivity.this, R.style.AppTheme_default, appConstants.isOverrideResultScreen());
                }
            }
        } catch (Exception e) {
            Toast.makeText(CheckoutActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
        }
    }

请帮我解决这个问题。

2 个答案:

答案 0 :(得分:0)

这种情况很少发生,并且当银行的交易响应在到达PayUmoney服务器之前由于连接故障而中断时发生。状态在银行营业时间结束后更新。如果状态未更新,请发送电子邮件至merchantcare@payumoney.com,并附上付款详情,如金额,付款ID(交易ID),日期和大致交易时间等。

答案 1 :(得分:0)

您需要请求所有参数。 这是代码如何使用C#在.NET中请求参数 您可以根据平台更改代码

protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write("<h2>BOLT Payment Response</h2>");
            Response.Write("Key: "+Request.Form["key"]+"<br />");
            Response.Write("Salt: " + Request.Form["salt"] + "<br />");
            Response.Write("Txnid: " + Request.Form["txnid"] + "<br />");
            Response.Write("Amount: " + Request.Form["amount"] + "<br />");
            Response.Write("Product Info: " + Request.Form["productinfo"] + "<br />");
            Response.Write("First Name: " + Request.Form["firstname"] + "<br />");
            Response.Write("Email: " + Request.Form["email"] + "<br />");
            Response.Write("Myhpayid: " + Request.Form["mihpayid"] + "<br />");
            Response.Write("Status: " + Request.Form["status"] + "<br />");
            Response.Write("UDF5: " + Request.Form["udf5"] + "<br />");
            Response.Write("Hash: " + Request.Form["hash"] + "<br />");

        }