関数
Complete::post( string $checkoutSessionId )
説明 説明
- $checkoutSessionId
(文字列) (必須)
ファイル: src/API/CheckoutSession/Complete.php
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | 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 ; } |