我已经按照说明如何为 PHP 集成 Amazon V2
https://github.com/amzn/amazon-pay-api-sdk-php
但我找不到任何部分如何实现完整结帐会话功能以获得“chargeID”。
这是我实施的
$payload = array(
'webCheckoutDetails' => array(
"checkoutResultReturnUrl" => HTTPS_SERVER . "index.php?route=payment/amazon/returnURL"
),
'paymentDetails' => array(
'paymentIntent' => 'Authorize',
'canHandlePendingAuthorization' => false,
'chargeAmount' => array(
'amount' => (int)$total_amount,
'currencyCode' => 'JPY'
),
),
'merchantMetadata' => array(
'merchantReferenceId' => $order_id,
'merchantStoreName' => 'MWYW Online Store',
'noteToBuyer' => 'Thank you for your order!'
)
);
try {
$client = new Amazon\Pay\API\Client($amazonpay_config);
$result = $client->updateCheckoutSession($checkoutSessionId, $payload);
$payload = array(
'chargeAmount' => array(
'amount' => (int)$total_amount,
'currencyCode' => 'JPY'
),
);
$result = $client->completeCheckoutSession($checkoutSessionId, $payload);
但是我收到了这样的错误消息
{"reasonCode":"InvalidCheckoutSessionStatus","message":"您试图对处于不允许该操作状态的 Checkout Session 调用操作"}
你能告诉我我的代码有什么问题吗?