英杰尼科 API:ACCESS_TO_MERCHANT_NOT_ALLOWED
Ingenico API : ACCESS_TO_MERCHANT_NOT_ALLOWED
我目前正在尝试让 Ingenico API 与我的 php 项目一起工作。
我在我的测试账户上生成了我的 api 密钥和秘密,并尝试使用这个端点创建一个会话:'/v2/'.$merchantID.'/sessions'
merchantID beeing 我的 PSPID 账户。
到目前为止,这是我的代码:
$apiKeyId = 'myAPIKey';
$apiSecret = 'myAPISecret';
$apiEndpoint = 'https://payment.preprod.direct.ingenico.com';
$hash = array(
'POST',
'application/json',
gmdate('D, d M Y H:i:s T'),
'/v2/'.$merchantID.'/sessions\n'
);
$headers = [
"Authorization: GCS v1HMAC:".$apiKeyId.":".base64_encode(hash_hmac('sha256', implode("\n", $hash), $apiSecret))
];
// Setup cURL
$ch = curl_init($apiEndpoint.'/v2/'.$merchantID.'/sessions');
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => $headers
));
// Send the request
$res = curl_exec($ch);
// Check for errors
if($res === FALSE)
die(curl_error($ch));
// Decode the response
$responseData = json_decode($res, TRUE);
// Close the cURL handler
curl_close($ch);
echo json_encode($responseData);
exit;
它应该等同于 url 中的 'minimal' 示例:
https://support.direct.ingenico.com/documentation/api/authentication , 不用SDK认证
无论我尝试什么,我都会得到以下结果 return :
{
"errorId": "b498810b-beda-4d50-8ba7-7d3da816b40e",
"errors": [
{
"code": "9007",
"id": "ACCESS_TO_MERCHANT_NOT_ALLOWED",
"category": "DIRECT_PLATFORM_ERROR",
"message": "ACCESS_TO_MERCHANT_NOT_ALLOWED",
"httpStatusCode": 403
}
],
"status": 403
}
如有任何帮助,我们将不胜感激。
经过几天的研究,我找到了答案,INGENICO 使用了一个名为 cryptoJS 的库来加密签名。
也许这些信息将来会对其他人有所帮助。
我目前正在尝试让 Ingenico API 与我的 php 项目一起工作。
我在我的测试账户上生成了我的 api 密钥和秘密,并尝试使用这个端点创建一个会话:'/v2/'.$merchantID.'/sessions'
merchantID beeing 我的 PSPID 账户。
到目前为止,这是我的代码:
$apiKeyId = 'myAPIKey';
$apiSecret = 'myAPISecret';
$apiEndpoint = 'https://payment.preprod.direct.ingenico.com';
$hash = array(
'POST',
'application/json',
gmdate('D, d M Y H:i:s T'),
'/v2/'.$merchantID.'/sessions\n'
);
$headers = [
"Authorization: GCS v1HMAC:".$apiKeyId.":".base64_encode(hash_hmac('sha256', implode("\n", $hash), $apiSecret))
];
// Setup cURL
$ch = curl_init($apiEndpoint.'/v2/'.$merchantID.'/sessions');
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => $headers
));
// Send the request
$res = curl_exec($ch);
// Check for errors
if($res === FALSE)
die(curl_error($ch));
// Decode the response
$responseData = json_decode($res, TRUE);
// Close the cURL handler
curl_close($ch);
echo json_encode($responseData);
exit;
它应该等同于 url 中的 'minimal' 示例: https://support.direct.ingenico.com/documentation/api/authentication , 不用SDK认证
无论我尝试什么,我都会得到以下结果 return :
{
"errorId": "b498810b-beda-4d50-8ba7-7d3da816b40e",
"errors": [
{
"code": "9007",
"id": "ACCESS_TO_MERCHANT_NOT_ALLOWED",
"category": "DIRECT_PLATFORM_ERROR",
"message": "ACCESS_TO_MERCHANT_NOT_ALLOWED",
"httpStatusCode": 403
}
],
"status": 403
}
如有任何帮助,我们将不胜感激。
经过几天的研究,我找到了答案,INGENICO 使用了一个名为 cryptoJS 的库来加密签名。
也许这些信息将来会对其他人有所帮助。