gpt4 book ai didi

php - 校验和不匹配错误 paytm 支付集成

转载 作者:行者123 更新时间:2023-12-03 17:31:06 35 4
gpt4 key购买 nike

我正在尝试在我的应用程序中实现 Paytm 支付网关,但它正在提供Bundle[{STATUS=TXN_FAILURE, ORDERID=order1, TXNAMOUNT=7.00, MID=cdBOMy65033449597261, RESPCODE=330, BANKTXNID=, CURRENCY=INR, RESPMSG=Paytm checksum mismatch.}]此错误,适用于测试和生产环境。
这是我生成校验和的 PHP 代码。

$paytmParams = array();
$paytmParams["MID"] = "cdBOMy65033449597261";
$paytmParams["ORDER_ID"] = "order1";
$paytmParams["CUST_ID"] = "cust1";
$paytmParams["MOBILE_NO"] = "9799990168";
$paytmParams["EMAIL"] = "droidwithme@gmail.com";
$paytmParams["CHANNEL_ID"] = "WAP";
$paytmParams["TXN_AMOUNT"] = "7.00";
$paytmParams["WEBSITE"] = "DEFAULT"; //tried WEBSTAGING and APPSTAGING
$paytmParams["INDUSTRY_TYPE_ID"] = "Retail";
$paytmParams["CALLBACK_URL"] = "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order1";

//Here checksum string will return by getChecksumFromArray() function.
$paytmChecksum = EndecPaytm::getChecksumFromArray($paytmParams, $merchantKey);

$responseBody = [
'message' => 'Checksum Generated.',
'data' => [
"CHECKSUMHASH" => $paytmChecksum,
"ORDER_ID" => "order1",
"payt_STATUS" => "1"
]
];
return ApiMethods::apiResponse('success', $responseBody);
这是我的android端代码,
     private void getPaytmWindow(String chkSm) {
PaytmPGService Service = PaytmPGService.getProductionService();
//Kindly create complete Map and checksum on your server-side and then put it here in paramMap.


HashMap<String, String> paramMap = new HashMap<>();
paramMap.put( "MID" , "cdBOMy65033449597261"); //cdBOMy65033449597261
// Key in your staging and production MID available in your dashboard
paramMap.put( "ORDER_ID" , "order1");
paramMap.put( "CUST_ID" , "cust1");
paramMap.put( "MOBILE_NO" , "9799990168");
paramMap.put( "EMAIL" , "droidwithme@gmail.com");
paramMap.put( "CHANNEL_ID" , "WAP");
paramMap.put( "TXN_AMOUNT" , "7.00");
paramMap.put( "WEBSITE" , "DEFAULT");
// This is the staging value. Production value is available in your dashboard
paramMap.put( "INDUSTRY_TYPE_ID" , "Retail");
// This is the staging value. Production value is available in your dashboard
paramMap.put( "CALLBACK_URL", "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=order1");
paramMap.put( "CHECKSUMHASH" , chkSm);

PaytmOrder Order = new PaytmOrder(paramMap);
Service.initialize(Order, null);
Service.startPaymentTransaction(this, true, true,
new PaytmPaymentTransactionCallback() {
@Override
public void someUIErrorOccurred(String inErrorMessage) {
// Some UI Error Occurred in Payment Gateway Activity.
// // This may be due to initialization of views in
// Payment Gateway Activity or may be due to //
// initialization of webview. // Error Message details
// the error occurred.
Utils.logD(TAG, "someUIErrorOccurred : " + inErrorMessage);
}

@Override
public void onTransactionResponse(Bundle inResponse) {
Log.d("LOG123444", "Payment Transaction : " + inResponse);

if (Objects.requireNonNull(inResponse.getString("STATUS")).contains("TXN_SUCCESS")) {

Toast.makeText(getApplicationContext(), "Transaction completed", Toast.LENGTH_LONG).show();
}


Utils.logD(TAG, inResponse.getString("STATUS"));

// Toast.makeText( getApplicationContext(), "Payment Transaction response " + inResponse.toString(), Toast.LENGTH_LONG ).show();
}

@Override
public void networkNotAvailable() {
// If network is not
// available, then this
// method gets called.
}

@Override
public void clientAuthenticationFailed(String inErrorMessage) {
// This method gets called if client authentication
// failed. // Failure may be due to following reasons //
// 1. Server error or downtime. // 2. Server unable to
// generate checksum or checksum response is not in
// proper format. // 3. Server failed to authenticate
// that client. That is value of payt_STATUS is 2. //
// Error Message describes the reason for failure.
Utils.logD(TAG, "clientAuthenticationFailed " + inErrorMessage);
}

@Override
public void onErrorLoadingWebPage(int iniErrorCode,
String inErrorMessage, String inFailingUrl) {
Utils.logD(TAG, "inErrorMessage " + inErrorMessage);
Utils.logD(TAG, "inFailingUrl " + inFailingUrl);

}

// had to be added: NOTE
@Override
public void onBackPressedCancelTransaction() {
// TODO Auto-generated method stub
}

@Override
public void onTransactionCancel(String inErrorMessage, Bundle inResponse) {
Utils.logD(TAG, "Payment Transaction Failed " + inErrorMessage);
Toast.makeText(getBaseContext(), "Payment Transaction Failed ", Toast.LENGTH_LONG).show();
}


});

}
这是 Gradle 依赖项
 implementation('com.paytm:pgplussdk:1.2.3') {
transitive = true
}
我也尝试过测试环境和生产环境,但每次都会出现校验和不匹配错误。
出于测试目的,我设置了硬编码的值。我在 Paytm QA 论坛上浏览了各种主题,但他们没有为这些主题提供任何足够的答案(与我的主题相同)。

最佳答案

在 PHP 中
改变这个

$paytmParams["ORDER_ID"] = "order1";
对此
$paytmParams["ORDERID"] = "order1";
APP内
改变这个
paramMap.put( "ORDER_ID" , "order1");
对此
paramMap.put( "ORDERID" , "order1");

关于php - 校验和不匹配错误 paytm 支付集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53878545/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com