在PHP中编码Amazon Flexible Payments秘密字符串的问题

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了在PHP中编码Amazon Flexible Payments秘密字符串的问题脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用亚马逊支付服务,他们要求我做这样的事情:

这是完整的签名,所以你可以看到我添加了签名方法

$string_to_sign = "GET\n
authorize.payments-sandBox.amazon.COM\n
cobranded-ui/actions/start?
SignatureMethod=HmacSHA256&Signatureversion=2&callerKey=my_key&callerReference=YourCallerReference&paymentReason=donation&piPElineName=SingleUse&returnUrl=http%3A%2F%2FyourwebsITe.com%2Freturn.htML&transactionAmount=4.0";

然后我加密它如下.

$encoded_string_to_sign = URLEncode(base64_encode(hash_hmac("sha256",$string_to_sign,'my_secret_key')));

我这样做,但后来我从他们那里得到一个错误说:

Caller Input Exception: The following input(s) are either invalid or absent:[signatureMethod]

知道这里可能出了什么问题吗?

以下是整个代码:(变量分配上面的值)

<?PHP
$string_to_sign = 'GET
authorize.payments-sandBox.amazon.com/cobranded-ui/actions/startSignatureMethod=HmacSHA256&SignatureVersion=2&callerKey=AKIAJENBYSJCJX2IDWDQ&callerReference=YourCallerReference&paymentReason=donation&pipelineName=SingleUse&returnUrl=http%3A%2F%2FPRoblemio.com&transactionAmount=4.0';

    $encoded_string_to_sign = URLEncode(Base64_Encode(hash_hmac("sha256",'my_secret_key')));

$amazon_request_sandBox = 'https://authorize.payments-sandBox.amazon.com/cobranded-ui/actions/start?SignatureVersion=2&returnUrl='.$return_url.'&paymentReason='.$payment_reason.'&callerReference=YourCallerReference&callerKey='.$my_access_key_id.'&transactionAmount=4.0&pipelineName=SingleUse&SignatureMethod=HmacSHA256&Signature='.$encoded_string_to_sign;

//echo $amazon_request_sandBox; - use this if you want to see the resulting request and paste it into the browser

header('Location: '.$amazon_request_sandBox);
?>

谢谢!!

@H_502_22@

脚本宝典总结

以上是脚本宝典为你收集整理的在PHP中编码Amazon Flexible Payments秘密字符串的问题全部内容,希望文章能够帮你解决在PHP中编码Amazon Flexible Payments秘密字符串的问题所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。