我正在尝试在我的管理面板中集成Paytm付款网关Refund Api。我已经按照Refund Api文档实施了代码,但是当我遇到退款请求时,它会给我错误消息“无效的退款请求”,错误代码为“ 600”。
https://developer.paytm.com/docs/refund-api/
$paytmParams = array();
$time = time();
/* body parameters */
$paytmParams["body"] = array(
"mid" => 'XXXXXXXXXXXXXXXXXXXX',
"txnType" => 'REFUND',
"orderId" => '310',
"txnId" => '20190914111212800110168261187592346',
"refId" => 'ORD_REFUND_' . $time,
"refundAmount" => 1,
);
$paytm = new EncodePaytm();
$checksum = $paytm->getChecksumFromString(json_encode($paytmParams["body"]), "XXXXXXXXXXXX");
$paytmParams["head"] = array(
"clientId" => "C11",
"signature" => "$checksum",
);
/* prepare JSON string for request */
$post_data = json_encode($paytmParams);
/* for Production */
$url = "https://securegw.paytm.in/refund/apply";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
));
$response = curl_exec($ch);
$response = json_decode($response);
(
[head] => stdClass Object
(
[clientId] => C11
[responseTimestamp] => 1568657632715
[signature] => zeA1va5JfpiRTrmhytx8TdEr6djuFUtnf8zvpxPljgMr5jNo/uZNsHBcRJfjcfsR8gKZDupPjt4/nodRDcaoq5rJ4UmEtWTJMfSG3ZHZKo4=
[version] => v1
)
[body] => stdClass Object
(
[orderId] => 310
[mid] => XXXXXXXXXXXXXXXXXXXX
[resultInfo] => stdClass Object
(
[resultStatus] => TXN_FAILURE
[resultCode] => 600
[resultMsg] => Invalid refund request
)
[txnId] => 20190914111212800110168261187592346
[refundAmount] => 1
)
)
请帮助我为什么会出现此错误。从两天开始,我被困在这一点上。