3
我試圖在客戶端在CBUI中確認付款後驗證Amazon FPS CBUI的返回URL。我使用的代碼示例從亞馬遜亞馬遜FPS返回URL Validation with verifySignature PHP api返回「InvalidSignature」
public static function test() {
$utils = new Amazon_FPS_SignatureUtilsForOutbound();
$params["signature"] = $_GET['signature'];
$params["expiry"] = "10/2016";
$params["signatureVersion"] = $_GET['signatureVersion'];
$params["signatureMethod"] = $_GET['signatureMethod'];
$params["certificateUrl"] = $_GET['certificateUrl'];
$params["tokenID"] = $_GET['tokenID'];
$params["status"] = $_GET['status'];
$params["callerReference"] = $_GET['callerReference'];
$urlEndPoint = "http://mydomain.com/Amazon/IpnReturnUrlValidation/Samples/ReturnUrlVerificationSampleCode.php"; //Your return url end point.
print "Verifying return url signed using signature v2 ....\n";
//return url is sent as a http GET request and hence we specify GET as the http method.
//Signature verification does not require your secret key
print "Is signature correct: " . $utils->validateRequest($params, $urlEndPoint, "GET") . "\n";
}
所有我從超全局變量$ _GET使用正確的值(我認爲),但我總是得到這樣的響應參數:
<Response><Errors><Error><Code>InvalidSignature</Code><Message>The request signature we calculated does not match the signature you provided.</Message></Error></Errors><RequestID>bb922e49-af5e-43ba-a3d0-464ce2851222</RequestID></Response>
我還比較了Amazon返回的簽名參數與我發送給VerifySignature API的簽名參數的值,它們看起來相同。
在此先感謝您的幫助。