我试图整合JazzCash网关V2,并希望作出直接支付交易,这是由文档定义为“这是一个单一的交易,授权付款和转移资金从付款人的帐户到商家的帐户。”
下面是我的哈希函数
function get_SecureHash($data_array) {
ksort($data_array);
$str = '';
foreach($data_array as $key => $value) {
if(!empty($value)) {
$str = $str . '&' . $value;
}
}
$str = $saltkey.$str;
$pp_SecureHash = hash_hmac('sha256', $str, $saltkey);
return $pp_SecureHash;
}
我已经匹配了我的哈希,它与文档推荐的HashCalculator计算的哈希相同。https://github.com/aliabidzaidi/HashCalculator
我使用以下URL:
$post_url = "https://sandbox.jazzcash.com.pk/ApplicationAPI/API/Purchase/PAY";
我的数组看起来如下:
$data_array = array(
"pp_IsRegisteredCustomer"=> "yes",
"pp_ShouldTokenizeCardNumber"=> "yes",
"pp_CustomerID"=> "25352",
"pp_CustomerEmail"=> "abc@abc.com",
"pp_CustomerMobile"=> "03331234567",
"pp_Version"=> "2.0",
"pp_TxnType"=> "MPAY",
"pp_TxnRefNo"=> "T".date('YmdHisu'),
"pp_MerchantID"=> "MYMERCHANTID",
"pp_Password"=> "MYPASSWORD",
"pp_Amount"=> "20000",
"pp_TxnCurrency"=> "PKR",
"pp_TxnDateTime"=> date('YmdHis'),
"pp_TxnExpiryDateTime"=> date('YmdHis',strtotime("+1 hours")),
"pp_BillReference"=> "billRef",
"pp_Description"=> "Description of transaction",
"pp_CustomerCardNumber"=> "512345000000008",
"pp_CustomerCardCVV"=> "100",
"pp_CustomerCardExpiry"=> "01/39",
"pp_SecureHash"=> "",
"pp_DiscountedAmount"=> "",
"pp_DiscountBank"=> "",
"pp_UsageMode"=> "API"
);
当我运行curl时,我得到以下输出:
{"responseCode":"110","responseMessage":"Please provide a valid value for pp_ Txn Ref No.","status":null,"pp_RetreivalReferenceNo":null,"secureHash":"9DE9F8E571F29CBD1316DFB2F0388E3FBE1CA9BC26FB9C284DF900DCCBA0C301"}
接下来我可以尝试什么?
1条答案
按热度按时间nx7onnlm1#
这可能是因为pp_TxnDateTime和pp_TxnRefNo的日期格式发生了变化
在阵列中,
"pp_TxnRefNo"=> "T".date('YmdHisu')
和"pp_TxnDateTime"=> date('YmdHis')
确保格式相同,因此,更改以下内容:
"pp_TxnRefNo"=> "T".date('YmdHisu')
转换为"pp_TxnRefNo"=> "T".date('YmdHis')
我希望它能起作用。