関数
Complete::post( string $checkoutSessionId )
Completes a checkout session
説明 説明
- $checkoutSessionId
(文字列) (必須)
ファイル: src/API/CheckoutSession/Complete.php
public function post($checkoutSessionId) { $order = (new API\WelcartEntries())->getOrder(); $payload = [ 'chargeAmount' => [ 'amount' => $order['total_full_price'], 'currencyCode' => usces_crcode('return'), ], ]; $headers = ['x-amz-pay-Idempotency-Key' => uniqid()]; try { $client = $this->module->getAmazonClient(); $result = $client->completeCheckoutSession($checkoutSessionId, $payload, $headers); if ($this->module->errors->hasError($result)) { return $this->module->errors->getAmzErrorResponse($result, $this); } } catch (\Exception $e) { return $this->module->errors->getErrorResponse( GenericErrorStore::AMAZON_PAY_SDK_CLIENT_EXCEPTION, [$e->getMessage()] ); } return $result; }