【发布时间】:2015-09-22 18:52:46
【问题描述】:
我对计算哈希的方式有点困惑。集成指南和一些集成工具包根据所有排序参数计算(PHP 工具包已将这部分代码注释掉)。但是 PHP 集成工具包和一些在线教程仅从其中几个(密钥、帐户 ID、金额、订单、返回 url 和模式)计算请求哈希,并且确实有效。
我正在寻找这种状态的解释。
我在计算响应哈希时也遇到了一些困难。
$data = $config['secretKey'];
$hash = $params['SecureHash'];
unset($params['SecureHash']);
ksort($params);
foreach ($params as $param) {
if (strlen($param) > 0) {
$data .= '|' . $param;
};
}
$data = hash($config['hashAlgoritm'], $data); // The same hash algorithm used for request
return $data == $hash;
而且响应似乎不包含 AccountID。
ResponseCode = '0'
ResponseMessage = 'Transaction Successful'
DateCreated = '2015-09-23 00:18:15'
PaymentID = '42609232'
MerchantRefNo = '223'
Amount = '1.00'
Mode = 'TEST'
BillingName = 'John Raj'
BillingAddress = 'Arcot Road'
BillingCity = 'Chennai'
BillingState = 'Tamil Nadu'
BillingPostalCode = '600001'
BillingCountry = 'IND'
BillingPhone = '04423452345'
BillingEmail = 'test@40test.test'
DeliveryName = 'John Esak'
DeliveryAddress = 'Arcot Road'
DeliveryCity = 'Chennai'
DeliveryState = 'Tamil Nadu'
DeliveryPostalCode = '600001'
DeliveryCountry = 'IND'
DeliveryPhone = '04423452345'
Description = 'Test Order Description'
IsFlagged = 'NO'
TransactionID = '110978476'
PaymentMethod = '1001'
RequestID = '7331147'
SecureHash = 'f9101f3cbf53be4da75e51c208775953'
【问题讨论】:
标签: php payment-gateway