我目前正在嘗試使 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 中的“最小”示例:https : //support.direct.ingenico.com/documentation/api/authentication,無需 SDK 進行身份驗證
無論我嘗試什么,我都會得到以下回報:
{
"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
}
任何幫助,將不勝感激。
uj5u.com熱心網友回復:
經過幾天的研究,我找到了答案,INGENICO 使用了一個名為 cryptoJS 的庫來加密簽名。
也許這些資訊將來會幫助其他人。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/369547.html
上一篇:使用路徑變數反應管理員資源名稱
下一篇:將查詢結果賦給變數并回傳變數
