如何获取payumney支付的交易状态
Posted
技术标签:
【中文标题】如何获取payumney支付的交易状态【英文标题】:How to get transaction status of payumoney payment 【发布时间】:2018-02-26 05:16:51 【问题描述】:我已将 PayUMoney 与我的 android 应用程序集成,交易工作正常,但我没有收到任何响应数据,我必须根据支付交易的状态执行一些操作(成功时我必须执行一些操作 &失败时我必须执行一些其他操作)。
这是我的代码
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();
请帮帮我。
【问题讨论】:
【参考方案1】:这是一种罕见的情况,当银行的交易响应在到达 PayUmoney 服务器之前由于连接失败而中断时会发生这种情况。状态在银行营业时间后的一天结束时更新。如果状态未更新,请发送电子邮件至 Merchantcare@payumoney.com,并提供付款详情,例如金额、付款 ID(交易 ID)、交易日期和大致时间等。
【讨论】:
【参考方案2】:您需要请求所有参数。 这是如何使用 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 />");
【讨论】:
以上是关于如何获取payumney支付的交易状态的主要内容,如果未能解决你的问题,请参考以下文章