How to get transaction status of payumoney payment

6.9k views Asked by At

I have integrate PayUMoney with my android app, transaction is working fine, but I am not getting any response data, I have to perform some operation based of the status of the payment transaction (On Success I have to perform some operation & On Failure I have to perform some other operation).

Here is my code

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();
        }
    }

Please help me on this.

2

There are 2 answers

0
RUSHABH SHAH On

You need to request all the parameters. Here is the code how to request parameters in .NET with C# You can change the code according to the platform

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 />");

        }
0
Brijesh Tanwar On

This is a rare occurrence and happens when the transaction response from the bank is interrupted due to connection failure before it reaches PayUmoney server.

Status is updated at the end of the day after banking hours. In cases where the status is not updated, please send an email to [email protected] with payment details like amount, payment ID (transaction ID), date and approximate time of the transaction, etc.