为了账号安全,请及时绑定邮箱和手机立即绑定

亚马逊支付授权参考编号

亚马逊支付授权参考编号

PHP
慕工程0101907 2022-09-17 21:31:16
我将亚马逊支付集成到我的网站中,并按照亚马逊支付SDK简单结账中的说明进行操作。到目前为止,它一切都在工作,但是在最后一步中,代码示例显示我需要一个授权参考ID。namespace AmazonPay;session_start();// Create the parameters array$requestParameters = array();// Refer to GetDetails.php where the Amazon Order Reference ID was set$requestParameters['amazon_order_reference_id'] = 'AMAZON_ORDER_REFERENCE_ID';// Confirm the order by making the ConfirmOrderReference API call$response = $client->confirmOrderReference($requestParameters);$responsearray['confirm'] = json_decode($response->toJson());// If the API call was a success make the Authorize API callif($client->success){$requestParameters['authorization_amount'] = '175.00';############################################################## WHERE DO I GET THIS? ################$requestParameters['authorization_reference_id'] = 'Your Unique Reference Id';$requestParameters['seller_authorization_note'] = 'Authorizing payment';$requestParameters['transaction_timeout'] = 0;$response = $client->authorize($requestParameters);$responsearray['authorize'] = json_decode($response->toJson());}// If the Authorize API call was a success, make the Capture API call when you are ready to capture             for the order (for example when the order has been dispatched)if($client->success){$requestParameters['amazon_authorization_id'] = 'Parse the Authorize Response for this id';$requestParameters['capture_amount'] = '175.00';$requestParameters['currency_code'] = 'USD';$requestParameters['capture_reference_id'] = 'Your Unique Reference Id';$response = $client->capture($requestParameters);$responsearray['capture'] = json_decode($response->toJson());}// Echo the Json encoded array for the Ajax successecho json_encode($responsearray);如上所示,需要设置“authorization_reference_id”。但我不知道如何得到它。它不在我之前对设置新订单的响应中。它也不包括在“确认订单参考”响应中。我在这里错过了什么,还是代码示例不完整?$requestParameters['authorization_reference_id'] = 'Your Unique Reference Id';感谢您的任何帮助
查看完整描述

1 回答

?
慕田峪7331174

TA贡献1828条经验 获得超13个赞

authorization_reference_id是你给的。它应该是唯一的。

您可以使用PHP中的内置函数来生成它。对于每个请求,它必须是唯一的。uniqid

$requestParameters['authorization_reference_id'] = uniqid();


查看完整回答
反对 回复 2022-09-17
  • 1 回答
  • 0 关注
  • 210 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号