发出亚马逊灵活付款请求时出现无效签名错误

发布于 12-25 23:40 字数 920 浏览 5 评论 0原文

我正在使用 PHP 在 Amazon 中按照这些说明进行工作:http://docs.amazonwebservices。 com/AmazonFPS/latest/FPSBasicGuide/APPNDX_GenerateaSignature.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”,因为亚马逊没有给出要在其中放置其他内容的说明。我如何知道亚马逊需要我在该功能中放置哪个键?我在他们的说明中没有注意到这一点。但也许我做错了什么?

I am working from these instructions in Amazon with PHP: http://docs.amazonwebservices.com/AmazonFPS/latest/FPSBasicGuide/APPNDX_GeneratingaSignature.html

and here is how I make my signature:

$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"))); 

But I am not sure why the signature isn't encoded correctly. One thing to look at is the hash_hmac("sha256", $string_to_sign, "1") where I randomly put the "1" because Amazon didn't give instructions for what other thing to put in there. How do I know which key in that function Amazon needs me to place? I didn't notice it in their instructions. But maybe it is something else I am doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七婞2025-01-01 23:40:23

$key 参数使用的值是由亚马逊向您颁发的密钥。

正如我在对上一个问题的回答中所解释的,您确实应该查看FPS PHP 库

The value to use for the $key parameter is your Secret Key that you were issued by Amazon.

As I explained in the answer to your last question, you really should have a look at the code included in the FPS PHP library.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文