制作Amazon Flexible Payments请求时出现无效的签名错误

时间:2012-01-11 16:13:26

标签: php amazon-web-services amazon

我正在亚马逊的这些说明中使用PHP:http://docs.amazonwebservices.com/AmazonFPS/latest/FPSBasicGuide/APPNDX_GeneratingaSignature.html

以下是我签名的方式:

$string_to_sign = "GET\nauthorize.payments-sandbox.amazon.com\n/cobranded-ui/actions/start\n
SignatureMethod=HmacSHA256&SignatureVersion=2&callerKey='.$my_access_key_id.'&callerReference='.$caller_reference.'&paymentReason='.$payment_reason.'&pipelineName=SingleUse&returnUrl='.$return_url.'&transactionAmount=1.1";

$encoded_string_to_sign = URLEncode(Base64_Encode(hash_hmac("sha256", $string_to_sign, "1"))); 

但我不确定为什么签名编码不正确。要注意的一件事是hash_hmac("sha256", $string_to_sign, "1"),我随机地放置了“1”,因为亚马逊没有给出其他东西放在那里的说明。我怎么知道亚马逊需要我放置的那个功能中的哪个键?我没有在他们的指示中注意到它。但也许这是我做错的其他事情?

1 个答案:

答案 0 :(得分:0)

用于$key参数的值是您由亚马逊发行的密钥。

正如我在answer to your last question中所解释的那样,您真的应该看一下FPS PHP library中包含的代码。

相关问题