---
title: Checkout Session
url: amazon-pay-api-v2/checkout-session.html
---

A Checkout Session represents a single active session (or engagement) for a buyer on your website. The Checkout Session can be used to facilitate a one-time charge, multiple charges, or recovery from a declined payment.  

The Checkout Session starts in the Open state. In the Open state, you can use the Checkout Session to retrieve checkout details such as shipping address, and set relevant payment details such as total order amount. You can also use the Checkout Session to either charge the buyer immediately, or exchange it for a Charge Permission that can be used to charge the buyer later.

The Checkout Session moves to the Completed state after you call <a href="../amazon-pay-api-v2/checkout-session.md#complete-checkout-session" target="_blank" rel="noopener noreferrer">Complete Checkout Session</a> if transaction processing was successful. In the Completed state, you can use the Checkout Session to retrieve references to a Charge Permission and also a Charge if payment authorization was requested.

The Checkout Session moves to the Canceled state after the Checkout Session has been in the Open state for 24 hours or if transaction processing failed. In the Canceled state, you can use the Checkout Session to retrieve why checkout failed.

Note that Amazon Pay permanently deletes Checkout Session objects and any associated information after 30 days. 

<script>
  function keySpecifics(){
    const keyQuery = "?environmentSpecificKeys=";
    const currentSetting = window.location.search?.split("?environmentSpecificKeys=")[1] ?? 'false';
    const newSetting = currentSetting === 'false' ? 'true' : 'false';
    window.location = window.location.origin + window.location.pathname + keyQuery + newSetting // +  window.location.hash (not included as it feels weird to jump down)
  }
</script>
<div style="display:none" class="environmentSpecificKeys">
  <div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> If your publicKeyId <b>_does not_</b> have an environment prefix (does not begin with 'SANDBOX' or 'LIVE') follow <a href='#' onclick='keySpecifics()' rel='noopener noreferrer'>these instructions</a> instead.</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
  <div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> If your publicKeyId has an environment prefix (for example: SANDBOX-AFVX7ULWSGBZ5535PCUQOY7B) follow <a href='#' onclick='keySpecifics()' rel='noopener noreferrer'>these instructions</a> instead.</div>
</div>


Supported operations:

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#ustab" data-toggle="tab">US</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#eutab" data-toggle="tab">EU / UK</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#jptab" data-toggle="tab">JP</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="ustab" markdown="block">   
<div markdown="block">
* **Create Checkout Session** - POST https://pay-api.amazon.com/:version/checkoutSessions
* **Get Checkout Session** - GET https://pay-api.amazon.com/:version/checkoutSessions/:checkoutSessionId
* **Update Checkout Session** - PATCH https://pay-api.amazon.com/:version/checkoutSessions/:checkoutSessionId
* **Complete Checkout Session** - POST https://pay-api.amazon.com/:version/checkoutSessions/:checkoutSessionId/complete
* **Finalize Checkout Session** - POST https://pay-api.amazon.com/:version/checkoutSessions/:checkoutSessionId/finalize
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="eutab" markdown="block">
<div markdown="block">
* **Create Checkout Session** - POST https://pay-api.amazon.eu/:version/checkoutSessions
* **Get Checkout Session** - GET https://pay-api.amazon.eu/:version/checkoutSessions/:checkoutSessionId
* **Update Checkout Session** - PATCH https://pay-api.amazon.eu/:version/checkoutSessions/:checkoutSessionId
* **Complete Checkout Session** - POST https://pay-api.amazon.eu/:version/checkoutSessions/:checkoutSessionId/complete
* **Finalize Checkout Session** - POST https://pay-api.amazon.eu/:version/checkoutSessions/:checkoutSessionId/finalize
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jptab" markdown="block">
<div markdown="block">
* **Create Checkout Session** - POST https://pay-api.amazon.jp/:version/checkoutSessions
* **Get Checkout Session** - GET https://pay-api.amazon.jp/:version/checkoutSessions/:checkoutSessionId
* **Update Checkout Session** - PATCH https://pay-api.amazon.jp/:version/checkoutSessions/:checkoutSessionId
* **Complete Checkout Session** - POST https://pay-api.amazon.jp/:version/checkoutSessions/:checkoutSessionId/complete
* **Finalize Checkout Session** - POST https://pay-api.amazon.jp/:version/checkoutSessions/:checkoutSessionId/finalize
</div>
  </div>
</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#ustabNESK" data-toggle="tab">US</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#eutabNESK" data-toggle="tab">EU / UK</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#jptabNESK" data-toggle="tab">JP</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="ustabNESK" markdown="block">   
<div markdown="block">
* **Create Checkout Session** - POST https://pay-api.amazon.com/:environment/:version/checkoutSessions
* **Get Checkout Session** - GET https://pay-api.amazon.com/:environment/:version/checkoutSessions/:checkoutSessionId
* **Update Checkout Session** - PATCH https://pay-api.amazon.com/:environment/:version/checkoutSessions/:checkoutSessionId
* **Complete Checkout Session** - POST https://pay-api.amazon.com/:environment/:version/checkoutSessions/:checkoutSessionId/complete
* **Finalize Checkout Session** - POST https://pay-api.amazon.com/:environment/:version/checkoutSessions/:checkoutSessionId/finalize
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="eutabNESK" markdown="block">
<div markdown="block">
* **Create Checkout Session** - POST https://pay-api.amazon.eu/:environment/:version/checkoutSessions
* **Get Checkout Session** - GET https://pay-api.amazon.eu/:environment/:version/checkoutSessions/:checkoutSessionId
* **Update Checkout Session** - PATCH https://pay-api.amazon.eu/:environment/:version/checkoutSessions/:checkoutSessionId
* **Complete Checkout Session** - POST https://pay-api.amazon.eu/:environment/:version/checkoutSessions/:checkoutSessionId/complete
* **Finalize Checkout Session** - POST https://pay-api.amazon.eu/:environment/:version/checkoutSessions/:checkoutSessionId/finalize
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jptabNESK" markdown="block">
<div markdown="block">
* **Create Checkout Session** - POST https://pay-api.amazon.jp/:environment/:version/checkoutSessions
* **Get Checkout Session** - GET https://pay-api.amazon.jp/:environment/:version/checkoutSessions/:checkoutSessionId
* **Update Checkout Session** - PATCH https://pay-api.amazon.jp/:environment/:version/checkoutSessions/:checkoutSessionId
* **Complete Checkout Session** - POST https://pay-api.amazon.jp/:environment/:version/checkoutSessions/:checkoutSessionId/complete
* **Finalize Checkout Session** - POST https://pay-api.amazon.jp/:environment/:version/checkoutSessions/:checkoutSessionId/finalize
</div>
  </div>
</div>
</div>

***

* TOC
{:toc}
{::options toc_levels="3" /}

### Checkout Session object

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAAMa0J'>
            <td id='s:ERL9CAAMa0J;ERL9CA4JgH8' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAAMa0J;ERL9CA2UFx4' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAPW7YB'>
            <td id='s:ERL9CAPW7YB;ERL9CA4JgH8' style='vertical-align: top;'>checkoutSessionId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAPW7YB;ERL9CA2UFx4' style='vertical-align: top;'>Checkout Session identifier<br><br>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>chargePermissionType<br /><br />Type: string
                <br /></td>
            <td id='' style='vertical-align: top;'>The type of Charge Permission requested<br><br>Supported values:
                    <ul>
                      <li>'OneTime' - The Charge Permission can only be used for a single order</li>
                      <li>'Recurring' - The Charge Permission can be used for recurring orders</li>
                    </ul>
            Default value: 'OneTime"
                <br /></td>
        </tr>
        <tr id=''>
             <td id='' style='vertical-align: top;'>recurringMetadata<br /><br />Type: <a href="#type-recurringmetadata">recurringMetadata</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>Metadata about how the recurring Charge Permission will be used. Amazon Pay only uses this information to calculate the Charge Permission expiration date and in buyer communication<br /><br />
            Note that it is still your responsibility to call <a href="../amazon-pay-api-v2/charge.md#create-charge" target="_blank" rel="noopener noreferrer">Create Charge</a> to charge the buyer for each billing cycle
                <br /></td>
        </tr>
        <tr id='ERL9CAMHIJQ'>
            <td id='s:ERL9CAMHIJQ;ERL9CA4JgH8' style='vertical-align: top;'>webCheckoutDetails<br><br>Type: <a href="#type-webcheckoutdetails">webCheckoutDetails</a>
                <br /></td>
            <td id='s:ERL9CAMHIJQ;ERL9CA2UFx4' style='vertical-align: top;'>URLs associated to the Checkout Session used for completing checkout
                <br /></td>
        </tr>
        <tr id='ERL9CA5u29J'>
            <td id='s:ERL9CA5u29J;ERL9CA4JgH8' style='vertical-align: top;'>productType<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA5u29J;ERL9CA2UFx4' style='vertical-align: top;'>Amazon Pay integration type. You can not set this value via Checkout Session operations, you must set it using button <code>productType</code> parameter
                <br /></td>
        </tr>
        <tr id='ERL9CAW1ynS'>
            <td id='s:ERL9CAW1ynS;ERL9CA4JgH8' style='vertical-align: top;'>paymentDetails<br><br>Type: <a href="#type-paymentdetails">paymentDetails</a>
                <br /></td>
            <td id='s:ERL9CAW1ynS;ERL9CA2UFx4' style='vertical-align: top;'>Payment details specified by the merchant, such as the amount and method for charging the buyer
                <br /></td>
        </tr>
        <tr id='ERL9CAghftb'>
            <td id='s:ERL9CAghftb;ERL9CA4JgH8' style='vertical-align: top;'>merchantMetadata<br><br>Type: <a href="#type-merchantmetadata">merchantMetadata</a>
                <br /></td>
            <td id='s:ERL9CAghftb;ERL9CA2UFx4' style='vertical-align: top;'>Merchant-provided order details
                <br /></td>
        </tr>
        <tr id='ERL9CAzuBJe'>
            <td id='s:ERL9CAzuBJe;ERL9CA4JgH8' style='vertical-align: top;'>platformId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAzuBJe;ERL9CA2UFx4' style='vertical-align: top;'>Merchant identifier of the Solution Provider (SP)- also known as ecommerce provider <br><br>Only SPs should use this field
                <br /></td>
        </tr>
        <tr id='ERL9CAdYXcn'>
            <td id='s:ERL9CAdYXcn;ERL9CA4JgH8' style='vertical-align: top;'>providerMetadata<br><br>Type: <a href="#type-providermetadata">providerMetadata</a>
                <br /></td>
            <td id='s:ERL9CAdYXcn;ERL9CA2UFx4' style='vertical-align: top;'>Payment service provider (PSP)-provided order information<br><br>Only PSPs should use these fields
                <br /></td>
        </tr>
        <tr id='ERL9CA3mi12'>
            <td id='s:ERL9CA3mi12;ERL9CA4JgH8' style='vertical-align: top;'>buyer<br><br>Type: <a href="#type-buyer">buyer</a>
                <br /></td>
            <td id='s:ERL9CA3mi12;ERL9CA2UFx4' style='vertical-align: top;'>Details about the buyer, such as their unique identifier, name, and email<br><br>This info will only be returned for a Checkout Session in the Open state
                <br /></td>
        </tr>
        <tr id='ERL9CA8sy3y'>
            <td id='s:ERL9CA8sy3y;ERL9CA4JgH8' style='vertical-align: top;'>shippingAddress<br><br>Type: <a href="#type-address">address</a>
                <br /></td>
            <td id='s:ERL9CA8sy3y;ERL9CA2UFx4' style='vertical-align: top;'>Shipping address selected by the buyer
                <br /></td>
        </tr>
        <tr id='ERL9CAbDPgI'>
            <td id='s:ERL9CAbDPgI;ERL9CAhTOM1' style='vertical-align: top;'>billingAddress<br><br>Type: <a href="#type-address">address</a>
                <br /></td>
            <td id='s:ERL9CAbDPgI;ERL9CAF5NFx' style='vertical-align: top;'>Billing address for buyer-selected payment instrument
                <br /></td>
        </tr>
        <tr id='ERL9CA6b5JL'>
            <td id='s:ERL9CA6b5JL;ERL9CA4JgH8' style='vertical-align: top;'>paymentPreferences<br><br>Type: list&lt;<a href="#type-paymentpreferences">paymentPreferences</a>&gt;
                <br /></td>
            <td id='s:ERL9CA6b5JL;ERL9CA2UFx4' style='vertical-align: top;'>List of payment instruments selected by the buyer
                <br /></td>
        </tr>
        <tr id='ERL9CAQ5o5K'>
            <td id='s:ERL9CAQ5o5K;ERL9CA4JgH8' style='vertical-align: top;'>statusDetails<br><br>Type: <a href="#type-statusdetails">statusDetails</a>
                <br /></td>
            <td id='s:ERL9CAQ5o5K;ERL9CA2UFx4' style='vertical-align: top;'>State of the Checkout Session object
                <br /></td>
        </tr>
        <tr id='ERL9CAnr8vi'>
            <td id='s:ERL9CAnr8vi;ERL9CA4JgH8' style='vertical-align: top;'>constraints<br><br>Type: list&lt;<a href="#type-constraint">constraint</a>&gt;
                <br /></td>
            <td id='s:ERL9CAnr8vi;ERL9CA2UFx4' style='vertical-align: top;'>Constraints that must be addressed to complete Amazon Pay checkout
                <br /></td>
        </tr>
        <tr id='ERL9CAFxu2I'>
            <td id='s:ERL9CAFxu2I;ERL9CA4JgH8' style='vertical-align: top;'>creationTimestamp<br><br>Type: dateTime
                <br /></td>
            <td id='s:ERL9CAFxu2I;ERL9CA2UFx4' style='vertical-align: top;'>Universal Time Coordinated (UTC) date and time when the Checkout Session was created in ISO 8601 format
                <br /></td>
        </tr>
        <tr id='ERL9CAkNc6l'>
            <td id='s:ERL9CAkNc6l;ERL9CA4JgH8' style='vertical-align: top;'>expirationTimestamp<br><br>Type: dateTime
                <br /></td>
            <td id='s:ERL9CAkNc6l;ERL9CA2UFx4' style='vertical-align: top;'>UTC date and time when the Checkout Session will expire in ISO 8601 format
                <br /></td>
        </tr>
        <tr id='ERL9CAceihI'>
            <td id='s:ERL9CAceihI;ERL9CA4JgH8' style='vertical-align: top;'>chargePermissionId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAceihI;ERL9CA2UFx4' style='vertical-align: top;'>Charge permission identifier returned after Checkout Session is complete<br><br> Used for creating charges for <a href="../amazon-pay-checkout/deferred-transactions.md">deferred transactions</a>
                <br /></td>
        </tr>
        <tr id='ERL9CAAdmWH'>
            <td id='s:ERL9CAAdmWH;ERL9CA4JgH8' style='vertical-align: top;'>chargeId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAAdmWH;ERL9CA2UFx4' style='vertical-align: top;'>Charge identifier returned after Checkout Session is complete<br><br>Used for processing refunds
                <br /></td>
        </tr>
        <tr id='ERL9CAS8DRa'>
            <td id='s:ERL9CAS8DRa;ERL9CA4JgH8' style='vertical-align: top;'>storeId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAS8DRa;ERL9CA2UFx4' style='vertical-align: top;'>Amazon Pay store ID. Retrieve this value from Amazon Pay Integration Central: <a href="https://sellercentral.amazon.com/gp/pyop/seller/integrationcentral/" target="_blank" rel="noopener noreferrer">US</a>, <a href="https://sellercentral-europe.amazon.com/gp/pyop/seller/integrationcentral/" target="_blank" rel="noopener noreferrer">EU</a>, <a href="https://sellercentral-japan.amazon.com/gp/pyop/seller/integrationcentral/" target="_blank" rel="noopener noreferrer">JP</a>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>deliverySpecifications<br /><br />Type: <a href="#type-deliveryspecifications">deliverySpecifications</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>Specify shipping restrictions to prevent buyers from selecting unsupported addresses from their Amazon address book 
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>releaseEnvironment<br /><br />Type: string
                <br /></td>
            <td id='' style='vertical-align: top;'>The environment the Checkout Session object was created in (either Sandbox or Live)
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>supplementaryData<br /><br />Type: string
                <br /></td>
            <td id='' style='vertical-align: top;'>Data enrichment field. Do not use
                <br /></td>
        </tr>
        <tr>
            <td style='vertical-align: top;'>checkoutButtonText<br /><br />Type: string
                <br /></td>
            <td style='vertical-align: top;'>Amazon Pay-provided button text for buyers who have chosen Affirm as payment instrument. For all other use cases, this value will be null 
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: webCheckoutDetails

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAz5j6a'>
            <td id='s:ERL9CAz5j6a;ERL9CAAufZX' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAz5j6a;ERL9CAneSOW' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CA6eLjw'>
            <td id='s:ERL9CA6eLjw;ERL9CAAufZX' style='vertical-align: top;'>checkoutReviewReturnUrl<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA6eLjw;ERL9CAneSOW' style='vertical-align: top;'>Checkout review URL provided by the merchant. Amazon Pay will redirect to this URL after the buyer selects their preferred payment instrument and shipping address<br><br>Note:<br>In the Live environment, URLs must use HTTPS protocol. The URL domain must be added to Seller Central. See <a href="../amazon-pay-checkout/get-set-up-for-integration.md#2-add-domains-to-seller-central" target="_blank" rel="noopener noreferrer">Add domains to Seller Central</a> for more information.<br>In Sandbox environment, you don't need a SSL certificate and can use the HTTP protocol if you're testing on localhost (http://localhost). You don't need to add URLs to the JavaScript Origins in SellerCentral<br><br>Max length: 1024 characters/bytes
                <br /></td>
        </tr>
        <tr id='ERL9CAxQRXB'>
            <td id='s:ERL9CAxQRXB;ERL9CAAufZX' style='vertical-align: top;'>checkoutResultReturnUrl<br><br>Type: string<br>
                <br /></td>
            <td id='s:ERL9CAxQRXB;ERL9CAneSOW' style='vertical-align: top;'>Checkout result URL provided by the merchant. Amazon Pay will redirect to this URL after completing the transaction<br><br>Note: In the Live environment, URLs must use HTTPS protocol. In Sandbox environment, you don't need a SSL certificate and can use the HTTP protocol if you're testing on localhost (http://localhost)<br><br>Max length: 1024 characters/bytes
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>checkoutCancelUrl<br><br>Type: string<br>
                <br /></td>
            <td id='' style='vertical-align: top;'>Checkout cancellation URL provided by the merchant. Amazon Pay will redirect to this URL if the buyer cancels checkout on any Amazon Pay hosted page<br><br>If you do not provide a <code>checkoutCancelUrl</code>, Amazon Pay will redirect the buyer using the following logic:
            <ul>
                <li>Payment and address selection hosted page - redirect to referrer URL unless it's a different domain than <code>checkoutReviewReturnUrl</code>. If there is a domain mismatch the buyer will be redirected to <code>checkoutReviewReturnUrl</code></li>
                <li>Update payment and address hosted page - redirect to <code>checkoutReviewReturnUrl</code></li>
                <li> Declined payment handling hosted page - redirect to <code>checkoutResultReturnUrl</code></li>
            </ul>
            Max length: 1024 characters/bytes
            <br /></td>
        </tr>
        <tr id='ERL9CAixONe'>
            <td id='s:ERL9CAixONe;ERL9CAAufZX' style='vertical-align: top;'>amazonPayRedirectUrl<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAixONe;ERL9CAneSOW' style='vertical-align: top;'>URL provided by Amazon Pay. Merchant will redirect to this page after setting transaction details to complete checkout<br><br>Max length: 256 characters/bytes
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>checkoutMode<br><br>Type: string
                <br /></td>
            <td id='' style='vertical-align: top;'>Specify whether the buyer will return to your website to review their order before completing checkout<br><br>Supported values:
                <ul>
                    <li>'ProcessOrder' - Buyer will complete checkout on the Amazon Pay hosted page immediately after clicking on the Amazon Pay button. <code>paymentDetails</code> is required when using 'ProcessOrder'. <code>addressDetails</code> is also required if you use 'ProcessOrder' with <code>productType</code> set to 'PayAndShip'</li>
                    </ul>
                </td>
        </tr>
    </tbody>
</table>

#### Type: deliverySpecifications

<table width="100%" border="1">
    <tbody>
         <tr id='ERL9CAz5j6a'>
            <td id='s:ERL9CAz5j6a;ERL9CAAufZX' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAz5j6a;ERL9CAneSOW' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CA09KrK'>
            <td id='s:ERL9CA09KrK;ERL9CAGYV2f' style='vertical-align: top;'>specialRestrictions<br><br>Type: list&lt;string&gt;
                <br /></td>
            <td id='s:ERL9CA09KrK;ERL9CAoKRxx' style='vertical-align: top;'>Rule-based restrictions<br><br>Note: Amazon will only validate this value in Sandbox. This parameter is ignored in the Live environment if an unsupported value is used<br><br>Supported values:
                <ul>
                    <li>'RestrictPOBoxes' - Marks PO box addresses in US, CA, GB, FR, DE, ES, PT, IT, AU as restricted</li>
                    <li>'RestrictPackstations' - Marks packstation addresses in DE as restricted</li>
                </ul>
                </td>
        </tr>
        <tr id='ERL9CAXT6Om'>
            <td id='s:ERL9CAXT6Om;ERL9CAGYV2f' style='vertical-align: top;'>addressRestrictions<br><br>Type: <a href="#type-addressrestrictions">addressRestrictions</a><br>
                <br /></td>
            <td id='s:ERL9CAXT6Om;ERL9CAoKRxx' style='vertical-align: top;'>Country-based restrictions<br><br>
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: addressRestrictions

<table width="100%" border="1">
     <tbody>
         <tr id='ERL9CAz5j6a'>
            <td id='s:ERL9CAz5j6a;ERL9CAAufZX' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAz5j6a;ERL9CAneSOW' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAJOAHz'>
            <td id='s:ERL9CAJOAHz;ERL9CAcxSMm' style='vertical-align: top;'>type<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAJOAHz;ERL9CAYTz80' style='vertical-align: top;'>Specifies whether addresses that match restrictions configuration should or should not be restricted<br><br>Note: Amazon will only validate this value in Sandbox. This parameter is ignored in the Live environment if an unsupported value is used<br><br>Supported values:
                <ul>
                    <li>'Allowed' - Mark addresses that don't match restrictions configuration as restricted</li>
                    <li>'NotAllowed' - Mark addresses that match restrictions configuration as restricted</li>
                </ul>
                <br /></td>
        </tr>
        <tr id='ERL9CAx7mom'>
            <td id='s:ERL9CAx7mom;ERL9CAcxSMm' style='vertical-align: top;'>restrictions<br><br>Type: hash&lt;countryCode:<a href="#type-restriction">restriction</a>&gt;<br>
                <br /></td>
            <td id='s:ERL9CAx7mom;ERL9CAYTz80' style='vertical-align: top;'>Hash of country-level restrictions that determine which addresses should or should not be restricted based on <code>addressRestrictions.type</code> parameter.<br><br>CountryCode is a string that represents the country code of the address in ISO 3166 format. Amazon will only validate CountryCode in Sandbox. CountryCode is ignored in the Live environment if an unsupported value is used<br><br>
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: recurringMetadata

<table width="100%" border="1">
    <tbody>
         <tr id=''>
            <td id='' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>frequency<br><br>Type: <a href="#type-frequency">frequency</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>Frequency at which the buyer will be charged using a recurring Charge Permission. You should specify a frequency even if you expect ad hoc charges<br /><br />
                Possible combinations:
                    <ul>
                      <li>Year: 1-3</li>
                      <li>Month: 1-36</li>
                      <li>Week: 1-57</li>
                      <li>Day: 1-1095</li>
                    </ul></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>amount<br><br>Type: <a href="#type-price">price</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>Amount the buyer will be charged for each recurring cycle. Set to null if amount varies
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: frequency

<table width="100%" border="1">
    <tbody>
         <tr id=''>
            <td id='' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>unit<br><br>Type: string
                <br /></td>
            <td id='' style='vertical-align: top;'>Frequency unit for each billing cycle. For multiple subscriptions, specify the frequency unit for the shortest billing cycle. Only use Variable if you charge the buyer on an irregular cadence, see  <a href="../amazon-pay-checkout/advanced-subscription-use-cases.md#handling-variable-cadence" target="_blank" rel="noopener noreferrer">handling variable cadence</a> for more info<br /><br />Supported values: 'Year', 'Month', 'Week', 'Day', 'Variable'
            </td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>value<br><br>Type: string
                <br /></td>
            <td id='' style='vertical-align: top;'>Number of frequency units per billing cycle. For example, to specify a weekly cycle set <code>unit</code> to Week and <code>value</code> to 1. You must set <code>value</code> to 0 if you're using variable <code>unit</code>
            </td>
        </tr>
    </tbody>
</table>

#### Type: restriction

<table width="100%" border="1">
    <tbody>
         <tr id='ERL9CAz5j6a'>
            <td id='s:ERL9CAz5j6a;ERL9CAAufZX' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAz5j6a;ERL9CAneSOW' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CADAGCN'>
            <td id='s:ERL9CADAGCN;ERL9CACXrxz' style='vertical-align: top;'>statesOrRegions<br><br>Type: list&lt;string&gt;
                <br /></td>
            <td id='s:ERL9CADAGCN;ERL9CA5jwy4' style='vertical-align: top;'>List of country-specific states that should or should not be restricted based on <code>addressRestrictions.type</code> parameter<br><br>     
            Note: 
            <ul>
                <li>US addresses - Use 2-character state codes (for example: WA, CA, IL)</li>
                <li>All other countries - This element is free text. Include all applicable variants: 2-character code, fully spelled out, and abbreviated</li>
            </ul></td>
        </tr>
        <tr id='ERL9CAlyFPG'>
            <td id='s:ERL9CAlyFPG;ERL9CACXrxz' style='vertical-align: top;'>zipCodes<br><br>Type: list&lt;string&gt;<br>
                <br /></td>
            <td id='s:ERL9CAlyFPG;ERL9CA5jwy4' style='vertical-align: top;'>List of country-specific zip codes that should or should not be restricted based on <code>addressRestrictions.type</code> parameter<br><br>
            Use wild card symbols to skip over variable alphanumeric characters. The "*" symbol will match multiple characters. The "?" symbol will only match a single character
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: paymentDetails

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAXIylR'>
            <td id='s:ERL9CAXIylR;ERL9CAW9hIG' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAXIylR;ERL9CAxLjJC' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CA8cLyf'>
            <td id='s:ERL9CA8cLyf;ERL9CAW9hIG' style='vertical-align: top;'>paymentIntent<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA8cLyf;ERL9CAxLjJC' style='vertical-align: top;'>Payment flow for charging the buyer<br><br>Supported values:
                <ul>
                    <li>'Confirm' - Create a Charge Permission to authorize and capture funds at a later time</li>
                    <li>'Authorize' - Authorize funds immediately and capture at a later time</li>
                    <li>'AuthorizeWithCapture' - Authorize and capture funds immediately. If you use this <code>paymentIntent</code> you can't set <code>canHandlePendingAuthorization</code> to true</li>
                </ul>
                </td>
        </tr>
        <tr id='ERL9CAlQj26'>
            <td id='s:ERL9CAlQj26;ERL9CAW9hIG' style='vertical-align: top;'>canHandlePendingAuthorization<br><br>Type: boolean</td>
            <td id='s:ERL9CAlQj26;ERL9CAxLjJC' style='vertical-align: top;'>Boolean that indicates whether merchant can handle pending response <br><br>If set to true:
                <ul>
                    <li>One-time checkout: Dynamic authorization is enabled. The Charge will either be in an "Authorized", "Declined", or "AuthorizationInitiated" state. If the Charge is in an "AuthorizationInitiated" state, Amazon Pay will process the authorization asynchronously and you will receive authorization results within 24 hours. See <a href="../amazon-pay-checkout/asynchronous-processing.md">asynchronous processing </a> and <a href="../amazon-pay-api-v2/charge.md#states-and-reason-codes">Charge states</a> for more info</li>
                    <li>Recurring checkout: Amazon Pay will process the authorization asynchronously and you will receive authorization results within 24 hours. See <a href="../amazon-pay-checkout/asynchronous-processing.md">asynchronous processing </a> for more info</li>
                </ul>
                <br /></td>
        </tr>
        <tr id='ERL9CAm6rqs'>
            <td id='s:ERL9CAm6rqs;ERL9CAW9hIG' style='vertical-align: top;'>chargeAmount<br><br>Type: <a href="#type-price">price</a>
                <br /></td>
            <td id='s:ERL9CAm6rqs;ERL9CAxLjJC' style='vertical-align: top;'>Amount to be processed using <code>paymentIntent</code> during checkout
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>totalOrderAmount<br><br>Type: <a href="#type-price">price</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>The total order amount. Only use if you need to split the order to capture additional payment after checkout is complete
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>presentmentCurrency<br><br>Type: string
                <br /></td>
            <td id='' style='vertical-align: top;'>The currency that the buyer will be charged in ISO 4217 format. Example: USD<br><br>See <a href="../amazon-pay-checkout/multi-currency-integration.md">multi-currency integration</a> for more info
                <br /></td>
        </tr>
        <tr id='OLS9CAGyE7P'>
            <td id='s:OLS9CAGyE7P;OLS9CAx2YtW' style='vertical-align: top;'>softDescriptor<br><br>Type: string
                <br /></td>
            <td id='s:OLS9CAGyE7P;OLS9CAC9I1k' style='vertical-align: top;'>Description shown on the buyer payment instrument statement. You can only use this parameter if <code>paymentIntent</code> is set to AuthorizeWithCapture<br><br>Do not store sensitive data about the buyer or the transaction in this field. Sensitive data includes, but is not limited to: government-issued identification, bank account numbers, or credit card numbers<br><br>The soft descriptor sent to the payment processor is: "AMZ* &lt;soft descriptor specified here&gt;"<br><br>Default: "AMZ*&lt;SELLER_NAME&gt; pay.amazon.com"<br>Max length: 16 characters/bytes
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>allowOvercharge<br><br>Type: boolean</td>
            <td id='' style='vertical-align: top;'>Only applicable if you registered in JP marketplace. This parameter will always return as null for all other regions
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>extendExpiration<br><br>Type: boolean</td>
            <td id='' style='vertical-align: top;'>Only applicable if you registered in JP marketplace. This parameter will always return as null for all other regions
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: price

<table width="100%" border="1">
    <tbody>
        <tr id='OLS9CAbORDS'>
            <td id='s:OLS9CAbORDS;OLS9CAjgdgj' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:OLS9CAbORDS;OLS9CAZr77k' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='OLS9CAW39VE'>
            <td id='s:OLS9CAW39VE;OLS9CAjgdgj' style='vertical-align: top;'>amount<br><br>Type: string
                <br /></td>
            <td id='s:OLS9CAW39VE;OLS9CAZr77k' style='vertical-align: top;'>Transaction amount
                <br /></td>
        </tr>
        <tr id='OLS9CATPsPn'>
            <td id='s:OLS9CATPsPn;OLS9CAjgdgj' style='vertical-align: top;'>currencyCode<br><br>Type: string
                <br /></td>
            <td id='s:OLS9CATPsPn;OLS9CAZr77k' style='vertical-align: top;'>Transaction currency code in ISO 4217 format<br /><br />Example: USD
                <br /></td>
        </tr>
    </tbody>
</table>


#### Type: providerMetadata

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAkCDAX'>
            <td id='' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CA263fp'>
            <td id='s:ERL9CA263fp;ERL9CAOoCvF' style='vertical-align: top;'>providerReferenceId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA263fp;ERL9CAIPemX' style='vertical-align: top;'>Payment service provider (PSP)-provided order identifier<br><br>Only PSPs should use these fields
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: merchantMetadata

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAF4Vxl'>
            <td id='s:ERL9CAF4Vxl;ERL9CAx7Nnu' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAF4Vxl;ERL9CAUSpyh' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAH2j8f'>
            <td id='s:ERL9CAH2j8f;ERL9CAx7Nnu' style='vertical-align: top;'>merchantReferenceId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAH2j8f;ERL9CAUSpyh' style='vertical-align: top;'>External merchant order identifier. The merchant order identifier is shared in <a href="../amazon-pay-checkout/buyer-communication.md">buyer communication</a> and in the buyer transaction history on the<a href="https://pay.amazon.com"> Amazon Pay website</a><br><br>Max length: 256 characters/bytes
                <br /></td>
        </tr>
        <tr id='ERL9CANEvec'>
            <td id='s:ERL9CANEvec;ERL9CAx7Nnu' style='vertical-align: top;'>merchantStoreName<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CANEvec;ERL9CAUSpyh' style='vertical-align: top;'>Merchant store name. Setting this parameter will override the default value configured in Seller Central (<a href="https://sellercentral.amazon.com/" target="_blank" rel="noopener noreferrer">US</a>, <a href="https://sellercentral-europe.amazon.com/" target="_blank" rel="noopener noreferrer">EU</a>, <a href="https://sellercentral-japan.amazon.com/" target="_blank" rel="noopener noreferrer">JP</a>). The store name is shared in <a href="../amazon-pay-checkout/buyer-communication.md">buyer communication</a> and in the buyer transaction history on the <a href="https://pay.amazon.com">Amazon Pay website</a><br><br>Max length: 50 characters/bytes
                <br /></td>
        </tr>
        <tr id='ERL9CACmKGe'>
            <td id='s:ERL9CACmKGe;ERL9CAx7Nnu' style='vertical-align: top;'>noteToBuyer<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CACmKGe;ERL9CAUSpyh' style='vertical-align: top;'>Description of the order that is shared in <a href="../amazon-pay-checkout/buyer-communication.md">buyer communication</a><br /><br />Do not store sensitive data about the buyer or the transaction in this field. Sensitive data includes, but is not limited to: government-issued identification, bank account numbers, or credit card numbers<br><br>Max length: 255 characters/bytes
                <br /></td>
        </tr>
        <tr id='ERL9CAznrdA'>
            <td id='s:ERL9CAznrdA;ERL9CAx7Nnu' style='vertical-align: top;'>customInformation<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAznrdA;ERL9CAUSpyh' style='vertical-align: top;'>Custom info for the order. This data is not shared in any <a href="../amazon-pay-checkout/buyer-communication.md">buyer communication</a><br /><br />Do not store sensitive data about the buyer or the transaction in this field. Sensitive data includes, but is not limited to: government-issued identification, bank account numbers, or credit card numbers<br><br>Max length: 4096 characters/bytes
                <br />
            </td>
        </tr>
    </tbody>
</table>

#### Type: buyer

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAbSsO3'>
            <td id='s:ERL9CAbSsO3;ERL9CAoXRkL' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAbSsO3;ERL9CABfkuC' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAEGLpK'>
            <td id='s:ERL9CAEGLpK;ERL9CAoXRkL' style='vertical-align: top;'>buyerId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAEGLpK;ERL9CABfkuC' style='vertical-align: top;'>Unique Amazon Pay buyer identifier<br><br>Max length: 42 characters/bytes
                <br /></td>
        </tr>
        <tr id='ERL9CAvifJc'>
            <td id='s:ERL9CAvifJc;ERL9CAoXRkL' style='vertical-align: top;'>name<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAvifJc;ERL9CABfkuC' style='vertical-align: top;'>Buyer name<br><br>Max length: 50 characters/bytes
                <br /></td>
        </tr>
        <tr id='ERL9CA9FgNU'>
            <td id='s:ERL9CA9FgNU;ERL9CAoXRkL' style='vertical-align: top;'>email<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA9FgNU;ERL9CABfkuC' style='vertical-align: top;'>Buyer email address<br><br>Max length: 64 characters/bytes
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>phoneNumber<br><br>Type: string
                <br /></td>
            <td id='' style='vertical-align: top;'>Buyer default billing address phone number<br><br>Max length: 20 characters/bytes
            </td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>primeMembershipTypes<br><br>Type: list&lt;primeMembershipType&gt;
                <br /></td>
            <td id='' style='vertical-align: top;'>List of buyer Prime memberships. This data is not available for general use
            </td>
        </tr>
    </tbody>
</table>

#### Type: paymentPreferences

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAng4gt'>
            <td id='s:ERL9CAng4gt;ERL9CAhTOM1' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAng4gt;ERL9CAF5NFx' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAlGrSe'>
            <td id='s:ERL9CAlGrSe;ERL9CAhTOM1' style='vertical-align: top;'>paymentDescriptor<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAlGrSe;ERL9CAF5NFx' style='vertical-align: top;'>Amazon Pay-provided description for buyer-selected payment instrument<br><br>Max length: 64 characters/bytes
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: address

<table width="100%" border="1">
  <tbody>
      <tr id='ERL9CAz3T00'>
          <td id='s:ERL9CAz3T00;ERL9CA6sOj9' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
              <br /></td>
          <td id='s:ERL9CAz3T00;ERL9CAOJuKu' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
              <br /></td>
      </tr>
      <tr id='ERL9CA1KP3f'>
          <td id='s:ERL9CA1KP3f;ERL9CA6sOj9' style='vertical-align: top;'>name<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CA1KP3f;ERL9CAOJuKu' style='vertical-align: top;'>Address name<br><br>Max length: 50 characters/bytes
              <br /></td>
      </tr>
      <tr id='ERL9CAh0jHA'>
          <td id='s:ERL9CAh0jHA;ERL9CA6sOj9' style='vertical-align: top;'>addressLine1<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CAh0jHA;ERL9CAOJuKu' style='vertical-align: top;'>The first line of the address<br><br>Max length: 180 characters/bytes
              <br /></td>
      </tr>
      <tr id='ERL9CAPTgSi'>
          <td id='s:ERL9CAPTgSi;ERL9CA6sOj9' style='vertical-align: top;'>addressLine2<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CAPTgSi;ERL9CAOJuKu' style='vertical-align: top;'>The second line of the address<br><br>Max length: 60 characters/bytes
              <br /></td>
      </tr>
      <tr id='ERL9CAUyxoY'>
          <td id='s:ERL9CAUyxoY;ERL9CA6sOj9' style='vertical-align: top;'>addressLine3<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CAUyxoY;ERL9CAOJuKu' style='vertical-align: top;'>The third line of the address<br><br>Max length: 60 characters/bytes
              <br /></td>
      </tr>
      <tr id='ERL9CAouIB6'>
          <td id='s:ERL9CAouIB6;ERL9CA6sOj9' style='vertical-align: top;'>city<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CAouIB6;ERL9CAOJuKu' style='vertical-align: top;'>City of the address<br><br>Max length: 50 characters/bytes
              <br /></td>
      </tr>
      <tr id='ERL9CA4C31a'>
          <td id='s:ERL9CA4C31a;ERL9CA6sOj9' style='vertical-align: top;'>county<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CA4C31a;ERL9CAOJuKu' style='vertical-align: top;'>County of the address<br><br>Max length: 50 characters/bytes
              <br /></td>
      </tr>
      <tr id='ERL9CAKfMWP'>
          <td id='s:ERL9CAKfMWP;ERL9CA6sOj9' style='vertical-align: top;'>district<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CAKfMWP;ERL9CAOJuKu' style='vertical-align: top;'>District of the address<br><br>Max length: 50 characters/bytes
              <br /></td>
      </tr>
      <tr id='ERL9CASuiJH'>
          <td id='s:ERL9CASuiJH;ERL9CA6sOj9' style='vertical-align: top;'>stateOrRegion<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CASuiJH;ERL9CAOJuKu' style='vertical-align: top;'>The state or region:
            <ul>
                <li>US and CA addresses - Response will always be a 2-character code</li>
                <li>All other countries - This element is free text and can be either a 2-character code, fully spelled out, or abbreviated</li>
              </ul> 
                Max length: 50 characters/bytes
                <br /></td>
      </tr>
      <tr id='ERL9CAuAJ0a'>
          <td id='s:ERL9CAuAJ0a;ERL9CA6sOj9' style='vertical-align: top;'>postalCode<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CAuAJ0a;ERL9CAOJuKu' style='vertical-align: top;'>Postal code of the address<br><br>Max length: 20 characters/bytes
              <br /></td>
      </tr>
      <tr id='ERL9CAo7zgS'>
          <td id='s:ERL9CAo7zgS;ERL9CA6sOj9' style='vertical-align: top;'>countryCode<br><br>Type: string
              <br /></td>
          <td id='s:ERL9CAo7zgS;ERL9CAOJuKu' style='vertical-align: top;'>Country code of the address in ISO 3166 format<br><br>Max length: 3 characters/bytes
              <br /></td>
      </tr>
      <tr id=''>
          <td id='' style='vertical-align: top;'>phoneNumber<br><br>Type: string
              <br /></td>
          <td id='' style='vertical-align: top;'>Phone number<br><br>Max length: 20 characters/bytes
              <br /></td>
      </tr>
  </tbody>
</table>

#### Type: addressDetails

Required parameters based on region. See <a href="../amazon-pay-checkout/address-formatting-and-validation.md"  target="_blank" rel="noopener noreferrer">address formatting and validation</a> for more info.


<table width="100%" border="1">
    <tbody>
        <tr id=''>
            <td id='' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='LVQ9CApmggV'>
            <td id='s:LVQ9CApmggV;LVQ9CANUUzj' style='vertical-align: top;'>name<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CApmggV;LVQ9CAA9Qgt' style='vertical-align: top;'>Address name <br><br>Max length: 50 characters/bytes
                <br /></td>
        </tr>
        <tr id='LVQ9CAoqV9q'>
            <td id='s:LVQ9CAoqV9q;LVQ9CANUUzj' style='vertical-align: top;'>addressLine1<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CAoqV9q;LVQ9CAA9Qgt' style='vertical-align: top;'>The first line of the address<br><br>Max length: 60 characters/bytes
                <br /></td>
        </tr>
        <tr id='LVQ9CAlZQDi'>
            <td id='s:LVQ9CAlZQDi;LVQ9CANUUzj' style='vertical-align: top;'>addressLine2<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CAlZQDi;LVQ9CAA9Qgt' style='vertical-align: top;'>The second line of the address<br><br>Max length: 60 characters/bytes
                <br /></td>
        </tr>
        <tr id='LVQ9CAzLuTz'>
            <td id='s:LVQ9CAzLuTz;LVQ9CANUUzj' style='vertical-align: top;'>addressLine3<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CAzLuTz;LVQ9CAA9Qgt' style='vertical-align: top;'>The third line of the address<br><br>Max length: 60 characters/bytes
                <br /></td>
        </tr>
        <tr id='LVQ9CAKaqh0'>
            <td id='s:LVQ9CAKaqh0;LVQ9CANUUzj' style='vertical-align: top;'>city<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CAKaqh0;LVQ9CAA9Qgt' style='vertical-align: top;'>City of the address<br><br>Max length: 50 characters/bytes
                <br /></td>
        </tr>
        <tr id='LVQ9CAAXzqE'>
            <td id='s:LVQ9CAAXzqE;LVQ9CANUUzj' style='vertical-align: top;'>districtOrCounty<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CAAXzqE;LVQ9CAA9Qgt' style='vertical-align: top;'>District or county of the address<br><br>Max length: 50 characters/bytes
                <br /></td>
        </tr>
        <tr id='LVQ9CApmbiD'>
            <td id='s:LVQ9CApmbiD;LVQ9CANUUzj' style='vertical-align: top;'>stateOrRegion<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CApmbiD;LVQ9CAA9Qgt' style='vertical-align: top;'>The state or region of the address<br><br>Max length: 50 characters/bytes
                <br /></td>
        </tr>
        <tr id='LVQ9CAQniKl'>
            <td id='s:LVQ9CAQniKl;LVQ9CANUUzj' style='vertical-align: top;'>postalCode<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CAQniKl;LVQ9CAA9Qgt' style='vertical-align: top;'>Postal code of the address<br><br>Max length: 20 characters/bytes
                <br /></td>
        </tr>
        <tr id='LVQ9CAKr1eM'>
            <td id='s:LVQ9CAKr1eM;LVQ9CANUUzj' style='vertical-align: top;'>countryCode<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CAKr1eM;LVQ9CAA9Qgt' style='vertical-align: top;'>Country code of the address in ISO 3166 format<br><br>Max length: 2 characters/bytes
                <br /></td>
        </tr>
        <tr id='LVQ9CAFqb9V'>
            <td id='s:LVQ9CAFqb9V;LVQ9CANUUzj' style='vertical-align: top;'>phoneNumber<br><br>Type: string
                <br /></td>
            <td id='s:LVQ9CAFqb9V;LVQ9CAA9Qgt' style='vertical-align: top;'>Phone number<br><br>Max length: 20 characters/bytes
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: statusDetails

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CA6ZDgu'>
            <td id='s:ERL9CA6ZDgu;ERL9CANROdL' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CA6ZDgu;ERL9CAhxxdO' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAToyr7'>
            <td id='s:ERL9CAToyr7;ERL9CANROdL' style='vertical-align: top;'>state<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAToyr7;ERL9CAhxxdO' style='vertical-align: top;'>Current object state
                <br /></td>
        </tr>
        <tr id='ERL9CA2PnwF'>
            <td id='s:ERL9CA2PnwF;ERL9CAYoYDq' style='vertical-align: top;'>reasonCode<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA2PnwF;ERL9CAiF60P' style='vertical-align: top;'>Reason code for current state
                <br /></td>
        </tr>
        <tr id='ERL9CACi1cW'>
            <td id='s:ERL9CACi1cW;ERL9CAYoYDq' style='vertical-align: top;'>reasonDescription<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CACi1cW;ERL9CAiF60P' style='vertical-align: top;'>An optional description of the Checkout Session state
                <br /></td>
        </tr>
        <tr id='ERL9CAPwBch'>
            <td id='s:ERL9CAPwBch;ERL9CANROdL' style='vertical-align: top;'>lastUpdatedTimestamp<br><br>Type: dateTime
                <br /></td>
            <td id='s:ERL9CAPwBch;ERL9CAhxxdO' style='vertical-align: top;'>UTC date and time when the state was last updated in ISO 8601 format
                <br /></td>
        </tr>
    </tbody>
</table>

#### Type: constraint

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAFBFUi'>
            <td id='s:ERL9CAFBFUi;ERL9CAy7zLM' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Parameter
                <br /></td>
            <td id='s:ERL9CAFBFUi;ERL9CAOjvnB' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAUItYj'>
            <td id='s:ERL9CAUItYj;ERL9CAy7zLM' style='vertical-align: top; width: 30%;'>constraintId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAUItYj;ERL9CAOjvnB' style='vertical-align: top; width: 70%;'>Code for any Checkout Session constraint
                <br /></td>
        </tr>
        <tr id='ERL9CA6D5f8'>
            <td id='s:ERL9CA6D5f8;ERL9CAy7zLM' style='vertical-align: top;'>description<br><br>Type: string<br>
                <br /></td>
            <td id='s:ERL9CA6D5f8;ERL9CAOjvnB' style='vertical-align: top;'>Description of the Checkout Session constraint
                <br /></td>
        </tr>
    </tbody>
</table>

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAaRYIF'>
            <td id='s:ERL9CAaRYIF;ERL9CADFEFR' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Constraint Code
                <br /></td>
            <td id='s:ERL9CAaRYIF;ERL9CAhB19s' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAt1p5S'>
            <td id='s:ERL9CAt1p5S;ERL9CADFEFR' style='vertical-align: top;'>CheckoutResultReturnUrlNotSet
                <br /></td>
            <td id='s:ERL9CAt1p5S;ERL9CAhB19s' style='vertical-align: top;'><code>checkoutResultReturnURL</code> has not been set on the Checkout Session
                <br /></td>
        </tr>
        <tr id='ERL9CAKGEaB'>
            <td id='s:ERL9CAKGEaB;ERL9CADFEFR' style='vertical-align: top;'>ChargeAmountNotSet
                <br /></td>
            <td id='s:ERL9CAKGEaB;ERL9CAhB19s' style='vertical-align: top;'><code>chargeAmount</code> has not been set on the Checkout Session
                <br /></td>
        </tr>
        <tr id='ERL9CAvPdOl'>
            <td id='s:ERL9CAvPdOl;ERL9CADFEFR' style='vertical-align: top;'>PaymentIntentNotSet
                <br /></td>
            <td id='s:ERL9CAvPdOl;ERL9CAhB19s' style='vertical-align: top;'><code>paymentIntent</code> has not been set on the Checkout Session
                <br /></td>
        </tr>
        <tr id='ERL9CARlmK7'>
            <td id='s:ERL9CARlmK7;ERL9CADFEFR' style='vertical-align: top;'>BuyerNotAssociated
                <br /></td>
            <td id='s:ERL9CARlmK7;ERL9CAhB19s' style='vertical-align: top;'>Buyer-preferred payment instrument or shipping address has not been set on the Checkout Session<br><br>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>RecurringFrequencyNotSet
                <br /></td>
            <td id='' style='vertical-align: top;'><code>frequency</code> has not been set on the Checkout Session. Only applicable if you're requesting a recurring Charge Permission <br><br>
                <br /></td>
        </tr>
    </tbody>
</table>

### States and reason codes

<img src='https://m.media-amazon.com/images/G/01/EPSDocumentation/AmazonPay/Integration/CheckoutSessionStates._CB1565018489_.png' />

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAz0jIG'>
            <td id='s:ERL9CAz0jIG;ERL9CAyy2E1' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>State
                <br /></td>
            <td id='s:ERL9CAz0jIG;ERL9CADFSon' style='vertical-align: top; font-weight: bold; width: 40%;' class='bold'>Description
                <br /></td>
            <td id='s:ERL9CAz0jIG;ERL9CAEhfA5' style='vertical-align: top; font-weight: bold; width: 40%;' class='bold'>Reason code
                <br /></td>
        </tr>
        <tr id='ERL9CAYfTlD'>
            <td id='s:ERL9CAYfTlD;ERL9CAyy2E1' style='vertical-align: top;'>Open
                <br /></td>
            <td id='s:ERL9CAYfTlD;ERL9CADFSon' style='vertical-align: top;'>The initial Checkout Session state. Checkout Session state will return missing value constraints, until mandatory fields are provided by the merchant using Update Checkout Session. After all constraints have been removed, the merchant will redirect the buyer to the AmazonPayRedirectUrl to complete checkout. The Checkout Session state will then move to either Completed or Canceled state<br><br>Note that the Checkout Session will move to Canceled state if the buyer doesn't complete checkout within 24 hours<br><br>Allowed operation(s): <br>GET Checkout Session<br>UPDATE Checkout Session<br>COMPLETE Checkout Session
                <br /></td>
            <td id='s:ERL9CAYfTlD;ERL9CAEhfA5' style='vertical-align: top;'>-
                <br /></td>
        </tr>
        <tr id='ERL9CAhrHuP'>
            <td id='s:ERL9CAhrHuP;ERL9CAyy2E1' style='vertical-align: top;'>Completed
                <br /></td>
            <td id='s:ERL9CAhrHuP;ERL9CADFSon' style='vertical-align: top;'>Checkout was successfully completed. The buyer was redirected to the <code>AmazonPayRedirectUrl</code> and checkout was confirmed with <a href="../amazon-pay-api-v2/checkout-session.md#complete-checkout-session" target="_blank" rel="noopener noreferrer">Complete Checkout Session</a>. The payment intent was finalized. The Checkout Session can no longer be used to perform another payment, or retry a charge<br><br>Note: if you set <code>canHandlePendingAuthorization</code> to true, the Checkout Session state will be in a Completed state after checkout is confirmed with <a href="../amazon-pay-api-v2/checkout-session.md#complete-checkout-session">Complete Checkout Session</a> even though the Authorization might later fail. See <a href="../amazon-pay-checkout/asynchronous-processing.md" target="_blank" rel="noopener noreferrer">asynchronous processing</a> for more info<br><br>Allowed operation(s): <br>GET Checkout Session (will return Charge Permission ID, Charge ID, and other Checkout Session details)<br>COMPLETE Checkout Session
                <br /></td>
            <td id='s:ERL9CAhrHuP;ERL9CAEhfA5' style='vertical-align: top;'>-
                <br /></td>
        </tr>
        <tr id='ERL9CA0bBHq'>
            <td id='s:ERL9CA0bBHq;ERL9CAyy2E1' style='vertical-align: top;'>Canceled
                <br /></td>
            <td id='s:ERL9CA0bBHq;ERL9CADFSon' style='vertical-align: top;'>Checkout was not successfully completed due to buyer abandoment, payment decline, or because checkout wasn't confirmed with <a href="../amazon-pay-api-v2/checkout-session.md#complete-checkout-session">Complete Checkout Session</a>. The payment intent was not finalized<br><br>Allowed operation(s): <br>GET CheckoutSession (will only return state and reasonCode)
                <br /></td>
            <td id='s:ERL9CA0bBHq;ERL9CAEhfA5' style='vertical-align: top;'><b>BuyerCanceled -</b> The buyer canceled the checkout by clicking the Return to previous page button<br><br><b>Expired - </b>The Checkout Session expired 24 hour after creation because there was no redirect to the amazonPayRedirectUrl, buyer did not complete payment, or the checkout was not confirmed with Complete Checkout Session<br><b><br>AmazonCanceled </b>- Amazon has canceled the transaction due to service unavailability. This is not a payment associated cancelation<br><br><b>Declined</b> - Generic payment decline reason code that includes fraud declines, failure to complete multi-factor authentication (MFA) challenge, and issues with the payment instrument
                <br /></td>
        </tr>
    </tbody>
</table>

## Operations

### Create Checkout Session

Create a new Amazon Pay Checkout Session to customize and manage the buyer experience, from when the buyer clicks the Amazon Pay button to when they complete checkout.

#### Request


<div style="display:none" class="environmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:version/checkoutSessions/" \<br />
-X POST<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE" <br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-H "x-amz-pay-idempotency-key:AVLo5tI10BHgEk2jEXAMPLEKEY"<br />
-d @request_body<br />
</code>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:environment/:version/checkoutSessions/" \<br />
-X POST<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE" <br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-H "x-amz-pay-idempotency-key:AVLo5tI10BHgEk2jEXAMPLEKEY"<br />
-d @request_body<br />
</code>
</div>

#### Request body

```JSON
{
    "webCheckoutDetails": {
        "checkoutReviewReturnUrl": "https://a.com/merchant-review-page"
    },
    "storeId": "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
    "scopes": ["name", "email", "phoneNumber", "billingAddress"],
    "deliverySpecifications": {
        "specialRestrictions": ["RestrictPOBoxes"],
        "addressRestrictions": {
            "type": "Allowed",
            "restrictions": {
                "US": {
                    "statesOrRegions": ["WA"],
                    "zipCodes": ["95050", "93405"]
                },
                "GB": {
                    "zipCodes": ["72046", "72047"]
                },
                "IN": {
                    "statesOrRegions": ["AP"]
                },
                "JP": {}
            }
        }
    }
}  
```


#### Request parameters

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAO0JHD'>
            <td id='s:ERL9CAO0JHD;ERL9CA2r6qD' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Name
                <br /></td>
            <td id='s:ERL9CAO0JHD;ERL9CAZAZrc' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Location
                <br /></td>
            <td id='s:ERL9CAO0JHD;ERL9CAoRgfP' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAMViVA'>
            <td id='s:ERL9CAMViVA;ERL9CA2r6qD' style='vertical-align: top;'>x-amz-pay-idempotency-key<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAMViVA;ERL9CAZAZrc' style='vertical-align: top;'>Header
                <br /></td>
            <td id='s:ERL9CAMViVA;ERL9CAoRgfP' style='vertical-align: top;'><a href="../amazon-pay-api-v2/idempotency.md" target="_blank" rel="noopener noreferrer">Idempotency key</a> to safely retry requests
                <br /></td>
        </tr>
        <tr id='ERL9CAvm2Or'>
            <td id='s:ERL9CAvm2Or;ERL9CAFccoh' style='vertical-align: top;'>webCheckoutDetails<br><b>(required)</b><br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-webcheckoutdetails" target="_blank" rel="noopener noreferrer">webCheckoutDetails</a>
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAxmCJ7' style='vertical-align: top;'>Object specifying e.g. the Checkout result URL provided by the merchant.<br><br>Note: `webCheckoutDetails` is **not required** for Buy Now Checkout integrations.
                <br /></td>
        </tr>
        <tr id='ERL9CAVOprL'>
            <td id='s:ERL9CAVOprL;ERL9CA2r6qD' style='vertical-align: top;'>storeId<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAVOprL;ERL9CAZAZrc' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAVOprL;ERL9CAoRgfP' style='vertical-align: top;'>Amazon Pay store ID. Retrieve this value from Amazon Pay Integration Central: <a href="https://sellercentral.amazon.com/gp/pyop/seller/integrationcentral/" target="_blank" rel="noopener noreferrer">US</a>, <a href="https://sellercentral-europe.amazon.com/gp/pyop/seller/integrationcentral/" target="_blank" rel="noopener noreferrer">EU</a>, <a href="https://sellercentral-japan.amazon.com/gp/pyop/seller/integrationcentral/" target="_blank" rel="noopener noreferrer">JP</a>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>chargePermissionType<br /><br />Type: string
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>The type of Charge Permission requested<br><br>Supported values:
                    <ul>
                      <li>'OneTime' - The Charge Permission can only be used for a single order</li>
                      <li>'Recurring' - The Charge Permission can be used for recurring orders</li>
                    </ul>
            Default value: 'OneTime"
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>recurringMetadata<br /><br />Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-recurringmetadata" target="_blank" rel="noopener noreferrer">recurringMetadata</a>
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>Metadata about how the recurring Charge Permission will be used. Amazon Pay only uses this information to calculate the Charge Permission expiration date and in buyer communication<br /><br />
            Note that it is still your responsibility to call <a href="../amazon-pay-api-v2/charge.md#create-charge" target="_blank" rel="noopener noreferrer" target="_blank" rel="noopener noreferrer">Create Charge</a> to charge the buyer for each billing cycle
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>deliverySpecifications<br /><br />Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-deliveryspecifications" target="_blank" rel="noopener noreferrer">deliverySpecifications</a>
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>Specify shipping restrictions and limit which addresses your buyer can select from their Amazon address book
                <br /></td>
        </tr>
        <tr id='ERL9CAgQ4T4'>
            <td  style='vertical-align: top;'>paymentDetails<br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-paymentdetails" target="_blank" rel="noopener noreferrer">paymentDetails</a>
                <br /></td>
            <td  style='vertical-align: top;'>Body
                <br /></td>
            <td  style='vertical-align: top;'>Payment details specified by the merchant such as the amount and method for charging the buyer<br><br>Modifiable: Multiple times before the buyer is redirected to the <code>amazonPayReturnUrl</code><br><br>Note: `paymentDetails` is **required** for Buy Now Checkout integrations.
                <br /></td>
        </tr>
        <tr id='ERL9CA6JHj6'>
            <td id='s:ERL9CA6JHj6;ERL9CAFccoh' style='vertical-align: top;'>merchantMetadata<br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-merchantmetadata" target="_blank" rel="noopener noreferrer">merchantMetadata</a>
                <br /></td>
            <td id='s:ERL9CA6JHj6;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CA6JHj6;ERL9CAxmCJ7' style='vertical-align: top;'>External order details provided by the merchant<br><br>Modifiable: Multiple times before the buyer is redirected to the <code>amazonPayReturnUrl</code>
                <br /></td>
        </tr>
        <tr id='ERL9CA7OsPD'>
            <td id='s:ERL9CA7OsPD;ERL9CAFccoh' style='vertical-align: top;'>platformId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA7OsPD;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CA7OsPD;ERL9CAxmCJ7' style='vertical-align: top;'>Merchant identifier of the Solution Provider (SP). <br><br>Only SPs should use this field.<br><br>Modifiable: Multiple times before the buyer is redirected to the <code>amazonPayReturnUrl</code>.
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>providerMetadata<br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-providermetadata" target="_blank" rel="noopener noreferrer">providerMetadata</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>Payment service provider (PSP)-provided order details<br><br>Only PSPs should use these fields
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>addressDetails<br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-addressdetails" target="_blank" rel="noopener noreferrer">addressDetail</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>Buyer provided shipping address. Only use this parameter if <code>checkoutMode</code> is ProcessOrder and <code>productType</code> is PayAndShip
                <br /></td>
        </tr>
    </tbody>
</table>

#### Sample Code

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-createCheckoutSession" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-createCheckoutSession" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-createCheckoutSession" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-createCheckoutSession" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-createCheckoutSession">   
<div markdown="block">
```
<?php
    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem',
        'region'        => 'YOUR_REGION_CODE',
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2',
    );

    $payload = array(
        "webCheckoutDetails" => array(
            "checkoutReviewReturnUrl" => "https://a.com/merchant-review-page"
        ),
        "storeId" => "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
        "scopes" => array(
            "name",
            "email",
            "phoneNumber",
            "billingAddress"
        ),
        "deliverySpecifications" => array(
            "specialRestrictions" => array(
                "RestrictPOBoxes"
            ),
            "addressRestrictions" => array(
                "type" => "Allowed",
                "restrictions" => array(
                    "US" => (object) array(
                        "statesOrRegions" => array(
                            "WA"
                        ),
                        "zipCodes" => array(
                            "95050",
                            "93405"
                        )
                    ),
                    "GB" => (object) array(
                        "zipCodes" => array(
                            "72046",
                            "72047"
                        )
                    ),
                    "IN" => (object) array(
                        "statesOrRegions" => array(
                            "AP"
                        )
                    ),
                    "JP" => (object) array()
                )
            )
        )
    );

    $headers = array('x-amz-pay-Idempotency-Key' => uniqid());

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->createCheckoutSession($payload, $headers);
        if ($result['status'] === 201) {
            // created
            $response = json_decode($result['response'], true);
            $checkoutSessionId = $response['checkoutSessionId'];

        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (\Exception $e) {
        // handle the exception
        echo $e . "\n";
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-createCheckoutSession">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.CheckoutSession;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public CheckoutSessionResponse CreateCheckoutSession()
    {
        CheckoutSessionScope[] scopes = new CheckoutSessionScope[] {
            CheckoutSessionScope.Name,
            CheckoutSessionScope.Email,
            CheckoutSessionScope.PhoneNumber,
            CheckoutSessionScope.BillingAddress
        };

        // prepare the request
        var request = new  CreateCheckoutSessionRequest
        (
            checkoutReviewReturnUrl: "https://a.com/merchant-review-page",
            storeId: "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
            scopes
        );
        
        request.DeliverySpecifications.SpecialRestrictions.Add(SpecialRestriction.RestrictPOBoxes);
        
        request.DeliverySpecifications.AddressRestrictions.Type = RestrictionType.Allowed;
        
        request.DeliverySpecifications.AddressRestrictions.AddCountryRestriction("US").AddStateOrRegionRestriction("WA").AddZipCodesRestriction("95050").AddZipCodesRestriction("93405");
        
        request.DeliverySpecifications.AddressRestrictions.AddCountryRestriction("GB").AddZipCodesRestriction("72046").AddZipCodesRestriction("72047");
        
        request.DeliverySpecifications.AddressRestrictions.AddCountryRestriction("IN").AddStateOrRegionRestriction("AP");
        
        request.DeliverySpecifications.AddressRestrictions.AddCountryRestriction("JP");

        // send the request
        CheckoutSessionResponse result = client.CreateCheckoutSession(request);

        // check if API call was successful
        if (!result.Success)
        {
            // do something, e.g. throw an error
        }

        return result;
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-createCheckoutSession">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

// for generating an idempotency key
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;

        String checkoutSessionId = null;
        JSONObject payload = new JSONObject();
        JSONObject webCheckoutDetails = new JSONObject();
        JSONObject deliverySpecifications = new JSONObject();
        JSONObject addressRestrictions = new JSONObject();
        JSONObject restrictions = new JSONObject();

        webCheckoutDetails.put("checkoutReviewReturnUrl", "https://a.com/merchant-review-page");
        payload.put("webCheckoutDetails", webCheckoutDetails);
        payload.put("storeId", "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId");;

        JSONArray scopes = new JSONArray();
        scopes.put("name");
        scopes.put("email");
        scopes.put("phoneNumber");
        scopes.put("billingAddress");
        payload.put("scopes", scopes);

        JSONArray specialRestrictions = new JSONArray();
        specialRestrictions.put("RestrictPOBoxes");
        deliverySpecifications.put("specialRestrictions",specialRestrictions);

        JSONObject US = new JSONObject();
        JSONArray statesOrRegions = new JSONArray();
        statesOrRegions.put("WA");
        JSONArray zipCodes = new JSONArray();
        zipCodes.put("95050");
        zipCodes.put("93405");
        US.put("statesOrRegions", statesOrRegions);
        US.put("zipCodes", zipCodes);
        restrictions.put("US",US);

        JSONObject GB = new JSONObject();
        JSONArray zipCodesGB = new JSONArray();
        zipCodesGB.put("72046");
        zipCodesGB.put("72047");
        GB.put("zipCodes", zipCodesGB);
        restrictions.put("GB",GB);

        JSONObject IN = new JSONObject();
        JSONArray statesOrRegionsIN = new JSONArray();
        statesOrRegionsIN.put("AP");
        IN.put("statesOrRegions", statesOrRegionsIN);
        restrictions.put("IN",IN);

        restrictions.put("JP",new JSONObject());

        addressRestrictions.put("type", "Allowed");
        addressRestrictions.put("restrictions", restrictions);
        deliverySpecifications.put("addressRestrictions", addressRestrictions);
        payload.put("deliverySpecifications", deliverySpecifications);
        
        Map<String, String> header = new HashMap<String, String>();
        header.put("x-amz-pay-idempotency-key", UUID.randomUUID().toString().replace("-", ""));
        
        response = webstoreClient.createCheckoutSession(payload, header);
    } catch (AmazonPayClientException e) {
          e.printStackTrace();
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-createCheckoutSession">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');
const uuidv4 = require('uuid/v4');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                
const payload = {
    webCheckoutDetails: {
        checkoutReviewReturnUrl: "https://a.com/merchant-review-page"
    },
    storeId: "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
    scopes: [
        "name",
        "email",
        "phoneNumber",
        "billingAddress"
    ],
    deliverySpecifications: {
        specialRestrictions: [
            "RestrictPOBoxes"
        ],
        addressRestrictions: {
            type: "Allowed",
            restrictions: {
                US: {
                    statesOrRegions: [
                        "WA"
                    ],
                    zipCodes: [
                        "95050",
                        "93405"
                    ]
                },
                GB: {
                    zipCodes: [
                        "72046",
                        "72047"
                    ]
                },
                IN: {
                    statesOrRegions: [
                        "AP"
                    ]
                },
                JP: {}
            }
        }
    }
};
                        
const headers = {
    'x-amz-pay-idempotency-key': uuidv4().toString().replace(/-/g, '')
};
                
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.createCheckoutSession(payload, headers);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-createCheckoutSession-NESK" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-createCheckoutSession-NESK" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-createCheckoutSession-NESK" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-createCheckoutSession-NESK" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-createCheckoutSession-NESK">   
<div markdown="block">
```
<?php
    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem',
        'region'        => 'YOUR_REGION_CODE',
        'sandbox'       => true,
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2',
    );

    $payload = array(
        "webCheckoutDetails" => array(
            "checkoutReviewReturnUrl" => "https://a.com/merchant-review-page"
        ),
        "storeId" => "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
        "scopes" => array(
            "name",
            "email",
            "phoneNumber",
            "billingAddress"
        ),
        "deliverySpecifications" => array(
            "specialRestrictions" => array(
                "RestrictPOBoxes"
            ),
            "addressRestrictions" => array(
                "type" => "Allowed",
                "restrictions" => array(
                    "US" => (object) array(
                        "statesOrRegions" => array(
                            "WA"
                        ),
                        "zipCodes" => array(
                            "95050",
                            "93405"
                        )
                    ),
                    "GB" => (object) array(
                        "zipCodes" => array(
                            "72046",
                            "72047"
                        )
                    ),
                    "IN" => (object) array(
                        "statesOrRegions" => array(
                            "AP"
                        )
                    ),
                    "JP" => (object) array()
                )
            )
        )
    );

    $headers = array('x-amz-pay-Idempotency-Key' => uniqid());

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->createCheckoutSession($payload, $headers);
        if ($result['status'] === 201) {
            // created
            $response = json_decode($result['response'], true);
            $checkoutSessionId = $response['checkoutSessionId'];

        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (\Exception $e) {
        // handle the exception
        echo $e . "\n";
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-createCheckoutSession-NESK">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.CheckoutSession;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            environment: Environment.Sandbox,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public CheckoutSessionResponse CreateCheckoutSession()
    {
        CheckoutSessionScope[] scopes = new CheckoutSessionScope[] {
            CheckoutSessionScope.Name,
            CheckoutSessionScope.Email,
            CheckoutSessionScope.PhoneNumber,
            CheckoutSessionScope.BillingAddress
        };

        // prepare the request
        var request = new  CreateCheckoutSessionRequest
        (
            checkoutReviewReturnUrl: "https://a.com/merchant-review-page",
            storeId: "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
            scopes
        );
        
        request.DeliverySpecifications.SpecialRestrictions.Add(SpecialRestriction.RestrictPOBoxes);
        
        request.DeliverySpecifications.AddressRestrictions.Type = RestrictionType.Allowed;
        
        request.DeliverySpecifications.AddressRestrictions.AddCountryRestriction("US").AddStateOrRegionRestriction("WA").AddZipCodesRestriction("95050").AddZipCodesRestriction("93405");
        
        request.DeliverySpecifications.AddressRestrictions.AddCountryRestriction("GB").AddZipCodesRestriction("72046").AddZipCodesRestriction("72047");
        
        request.DeliverySpecifications.AddressRestrictions.AddCountryRestriction("IN").AddStateOrRegionRestriction("AP");
        
        request.DeliverySpecifications.AddressRestrictions.AddCountryRestriction("JP");

        // send the request
        CheckoutSessionResponse result = client.CreateCheckoutSession(request);

        // check if API call was successful
        if (!result.Success)
        {
            // do something, e.g. throw an error
        }

        return result;
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-createCheckoutSession-NESK">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Environment;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

// for generating an idempotency key
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setEnvironment(Environment.SANDBOX)
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;

        String checkoutSessionId = null;
        JSONObject payload = new JSONObject();
        JSONObject webCheckoutDetails = new JSONObject();
        JSONObject deliverySpecifications = new JSONObject();
        JSONObject addressRestrictions = new JSONObject();
        JSONObject restrictions = new JSONObject();

        webCheckoutDetails.put("checkoutReviewReturnUrl", "https://a.com/merchant-review-page");
        payload.put("webCheckoutDetails", webCheckoutDetails);
        payload.put("storeId", "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId");;

        JSONArray scopes = new JSONArray();
        scopes.put("name");
        scopes.put("email");
        scopes.put("phoneNumber");
        scopes.put("billingAddress");
        payload.put("scopes", scopes);

        JSONArray specialRestrictions = new JSONArray();
        specialRestrictions.put("RestrictPOBoxes");
        deliverySpecifications.put("specialRestrictions",specialRestrictions);

        JSONObject US = new JSONObject();
        JSONArray statesOrRegions = new JSONArray();
        statesOrRegions.put("WA");
        JSONArray zipCodes = new JSONArray();
        zipCodes.put("95050");
        zipCodes.put("93405");
        US.put("statesOrRegions", statesOrRegions);
        US.put("zipCodes", zipCodes);
        restrictions.put("US",US);

        JSONObject GB = new JSONObject();
        JSONArray zipCodesGB = new JSONArray();
        zipCodesGB.put("72046");
        zipCodesGB.put("72047");
        GB.put("zipCodes", zipCodesGB);
        restrictions.put("GB",GB);

        JSONObject IN = new JSONObject();
        JSONArray statesOrRegionsIN = new JSONArray();
        statesOrRegionsIN.put("AP");
        IN.put("statesOrRegions", statesOrRegionsIN);
        restrictions.put("IN",IN);

        restrictions.put("JP",new JSONObject());

        addressRestrictions.put("type", "Allowed");
        addressRestrictions.put("restrictions", restrictions);
        deliverySpecifications.put("addressRestrictions", addressRestrictions);
        payload.put("deliverySpecifications", deliverySpecifications);
        
        Map<String, String> header = new HashMap<String, String>();
        header.put("x-amz-pay-idempotency-key", UUID.randomUUID().toString().replace("-", ""));
        
        response = webstoreClient.createCheckoutSession(payload, header);
    } catch (AmazonPayClientException e) {
          e.printStackTrace();
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-createCheckoutSession-NESK">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');
const uuidv4 = require('uuid/v4');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    sandbox: true,
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                
const payload = {
    webCheckoutDetails: {
        checkoutReviewReturnUrl: "https://a.com/merchant-review-page"
    },
    storeId: "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
    scopes: [
        "name",
        "email",
        "phoneNumber",
        "billingAddress"
    ],
    deliverySpecifications: {
        specialRestrictions: [
            "RestrictPOBoxes"
        ],
        addressRestrictions: {
            type: "Allowed",
            restrictions: {
                US: {
                    statesOrRegions: [
                        "WA"
                    ],
                    zipCodes: [
                        "95050",
                        "93405"
                    ]
                },
                GB: {
                    zipCodes: [
                        "72046",
                        "72047"
                    ]
                },
                IN: {
                    statesOrRegions: [
                        "AP"
                    ]
                },
                JP: {}
            }
        }
    }
};
                        
const headers = {
    'x-amz-pay-idempotency-key': uuidv4().toString().replace(/-/g, '')
};
                
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.createCheckoutSession(payload, headers);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>

#### Response

Returns <a href="https://restfulapi.net/http-status-201-created/" target="_blank" rel="noopener noreferrer">HTTP 201 status response code</a> if the operation was successful. Subsequent retry attempts using the same <a href="../amazon-pay-api-v2/idempotency.md" target="_blank" rel="noopener noreferrer">Idempotency Key</a> may return a <a href="https://restfulapi.net/http-status-200-ok" target="_blank" rel="noopener noreferrer">HTTP 200 status response code</a> if a new resource is not created.

```
{
    "checkoutSessionId": "bd504926-f659-4ad7-a1a9-9a747aaf5275",
    "webCheckoutDetails": {
        "checkoutReviewReturnUrl": "https://a.com/merchant-review-page",
        "checkoutResultReturnUrl": null,
        "checkoutCancelUrl": null,
        "amazonPayRedirectUrl": null
    },
    "productType": "PayAndShip",
    "chargePermissionType": "Recurring",   
    "recurringMetadata": {
        "frequency": { 
            "unit": "Month", 
            "value": "1" 
        },
        "amount": { 
            "amount": "30",
            "currencyCode": "USD"
        }
    }, 
    "paymentDetails": {
        "paymentIntent": null,
        "canHandlePendingAuthorization":false,
        "chargeAmount": null,
        "totalOrderAmount": null,
        "softDescriptor": null,
        "presentmentCurrency": null,
        "allowOvercharge": null,
        "extendExpiration": null
    },
    "merchantMetadata": {
        "merchantReferenceId": null,
        "merchantStoreName": null,
        "noteToBuyer": null,
        "customInformation": null
    },
    "supplementaryData": null, // Amazon Pay system data
    "buyer": null,
    "billingAddress": null,
    "paymentPreferences": [
        null
    ],
    "statusDetails": {
        "state": "Open",
        "reasonCode": null,
        "reasonDescription": null,
        "lastUpdatedTimestamp": "20191015T204327Z"
    },
    "shippingAddress": null,  // Null for PayOnly product type
    "platformId": null,
    "chargePermissionId": null,
    "chargeId": null,
    "constraints": [
        {
           "constraintId": "BuyerNotAssociated",
            "description": "There is no buyer associated with the Checkout Session. Return the checkout session id to the Amazon Pay Button to allow buyer to login."
        },
        {
           "constraintId": "ChargeAmountNotSet",
            "description": "chargeAmount is not set."
        },
        {
            "constraintId": "CheckoutResultReturnUrlNotSet",
            "description": "checkoutResultReturnUrl is not set."
        },
        {
            "constraintId": "PaymentIntentNotSet",
            "description": "paymentIntent is not set."
        }
    ],
    "creationTimestamp": "20191015T204313Z",
    "expirationTimestamp": "20191016T204313Z",
    "storeId": "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
    "deliverySpecifications": {
        "specialRestrictions": ["RestrictPOBoxes"],
        "addressRestrictions": {
            "type": "Allowed",
            "restrictions": {
                "US": {
                    "statesOrRegions": ["WA"],
                    "zipCodes": ["95050", "93405"]
                },
                "GB": {
                    "zipCodes": ["72046", "72047"]
                },
                "IN": {
                    "statesOrRegions": ["AP"]
                },
                "JP": {}
            }
        }
    },
    "providerMetadata": {
        "providerReferenceId": null
    },
    "checkoutButtonText": null,
    "releaseEnvironment": "Sandbox"
}
```

#### Error codes

<table width="100%" border="1">
    <tbody>
        <tr id=''>
            <td id='' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>HTTP status code
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Reason code
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'><br>400 BAD_REQUEST
                <br /></td>
            <td id='' style='vertical-align: top;'><br>CurrencyMismatch
                <br /></td>
            <td id='' style='vertical-align: top;'>The <code>chargeAmount</code> currency code provided in the request does not match the <code>presentmentCurrency</code> currency code
                <br /></td>
        </tr>
    </tbody>
</table>

Generic errors can be found <a href="../amazon-pay-api-v2/error-handling.md" target="_blank" rel="noopener noreferrer">here</a>. 

### Get Checkout Session

Get Checkout Session details includes buyer info, payment instrument details, and shipping address. Shipping address will only be returned if Checkout Session has PayAndShip product type. Use this operation to determine if checkout was successful after the buyer returns from the `AmazonPayRedirectUrl` to the specified `checkoutResultReturnUrl`.

#### Request


<div style="display:none" class="environmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:version/checkoutSessions/:checkoutSessionId"<br />
-X GET<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
</code>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:environment/:version/checkoutSessions/:checkoutSessionId"<br />
-X GET<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
</code>
</div>

#### Request parameters

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAVsuDr'>
            <td id='s:ERL9CAVsuDr;ERL9CAdoMUq' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Name
                <br /></td>
            <td id='s:ERL9CAVsuDr;ERL9CAoJhYx' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Location
                <br /></td>
            <td id='s:ERL9CAVsuDr;ERL9CA4xLvY' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAmASXg'>
            <td id='s:ERL9CAmASXg;ERL9CAdoMUq' style='vertical-align: top;'>CheckoutSessionId<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAmASXg;ERL9CAoJhYx' style='vertical-align: top;'>Path Parameter
                <br /></td>
            <td id='s:ERL9CAmASXg;ERL9CA4xLvY' style='vertical-align: top;'>Checkout session identifier
                <br /></td>
        </tr>
    </tbody>
</table>

#### Sample Code

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-getCheckoutSession" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-getCheckoutSession" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-getCheckoutSession" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-getCheckoutSession" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-getCheckoutSession">   
<div markdown="block">
```
<?php
    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID', 
        'private_key'   => 'keys/private.pem',
        'region'        => 'YOUR_REGION_CODE',
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );
        
    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->getCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275');
        if ($result['status'] === 200) {
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargeId = $response['chargeId'];
            $chargePermissionId = $response['chargePermissionId'];

            // NOTE: Once Checkout Session moves to a "Completed" state, buyer and shipping
            // details must be obtained from the getChargePermission() function call instead
            $buyerName = $response['buyer']['name'];
            $buyerAddress = $response['buyer']['shippingAddress'];
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-getCheckoutSession">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.CheckoutSession;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public void GetCheckoutSession(string checkoutSessionId)
    {
        // send the request
        CheckoutSessionResponse result = client.GetCheckoutSession(checkoutSessionId);

        // check if API call was successful
        if (!result.Success)
        {
            // handle the API error (use Status field to get the numeric error code)
        }
        // do something with the result, for instance:
        Buyer buyer = result.Buyer;
        Address shippingAddress = result.ShippingAddress;
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-getCheckoutSession">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Region;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new ApiConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = webstoreClient.getCheckoutSession("bd504926-f659-4ad7-a1a9-9a747aaf5275");
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }
}

```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-getCheckoutSession">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');
    
const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                    
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.getCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275');

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-getCheckoutSession-NESK" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-getCheckoutSession-NESK" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-getCheckoutSession-NESK" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-getCheckoutSession-NESK" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-getCheckoutSession-NESK">   
<div markdown="block">
```
<?php
    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID', 
        'private_key'   => 'keys/private.pem',
        'region'        => 'YOUR_REGION_CODE',
        'sandbox'       => true,
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );
        
    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->getCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275');
        if ($result['status'] === 200) {
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargeId = $response['chargeId'];
            $chargePermissionId = $response['chargePermissionId'];

            // NOTE: Once Checkout Session moves to a "Completed" state, buyer and shipping
            // details must be obtained from the getChargePermission() function call instead
            $buyerName = $response['buyer']['name'];
            $buyerAddress = $response['buyer']['shippingAddress'];
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-getCheckoutSession-NESK">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.CheckoutSession;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            environment: Environment.Sandbox,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public void GetCheckoutSession(string checkoutSessionId)
    {
        // send the request
        CheckoutSessionResponse result = client.GetCheckoutSession(checkoutSessionId);

        // check if API call was successful
        if (!result.Success)
        {
            // handle the API error (use Status field to get the numeric error code)
        }
        // do something with the result, for instance:
        Buyer buyer = result.Buyer;
        Address shippingAddress = result.ShippingAddress;
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-getCheckoutSession-NESK">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Environment;
import com.amazon.pay.api.types.Region;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new ApiConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setEnvironment(Environment.SANDBOX)
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = webstoreClient.getCheckoutSession("bd504926-f659-4ad7-a1a9-9a747aaf5275");
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }
}

```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-getCheckoutSession-NESK">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');
    
const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    sandbox: true,
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                    
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.getCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275');

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>

#### Response

Returns <a href="https://restfulapi.net/http-status-200-ok" target="_blank" rel="noopener noreferrer">HTTP 200 status response code</a> if the operation was successful.

```
{
    "checkoutSessionId": "bd504926-f659-4ad7-a1a9-9a747aaf5275",
    "webCheckoutDetails": {
        "checkoutReviewReturnUrl": "https://a.com/merchant-review-page",
        "checkoutResultReturnUrl": null,
        "checkoutCancelUrl": null,
        "amazonPayRedirectUrl": null
    },
    "productType": "PayAndShip",
    "paymentDetails": {
        "paymentIntent": null,
        "canHandlePendingAuthorization": false,
        "chargeAmount": null,
        "totalOrderAmount": null,
        "softDescriptor": null,
        "presentmentCurrency": null,
        "allowOvercharge": null,
        "extendExpiration": null
    },
    "merchantMetadata": {
        "merchantReferenceId": null,
        "merchantStoreName": null,
        "noteToBuyer": null,
        "customInformation": null
    },
    "supplementaryData": null, // Amazon Pay system data
    "buyer": {
        "buyerId": "buyerId",
        "name": "name-1",
        "email": "name@amazon.com",
        "phoneNumber": "800-000-0000",
        "primeMembershipTypes": null
    },
    "billingAddress":{ 
        "name": "Work",
        "addressLine1": "440 Terry Ave",
        "addressLine2": "",
        "addressLine3": "",
        "city": "Seattle",
        "county": "King",    
        "district": "Seattle",
        "stateOrRegion": "WA",
        "postalCode": "98121",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    "paymentPreferences": [
        {
            "paymentDescriptor": "Visa ****1111 (Amazon Pay)"
        }
    ],
    "statusDetails": {
        "state": "Open",
        "reasonCode": null,
        "reasonDescription": null,
        "lastUpdatedTimestamp": "20191015T204327Z"
    },
    "shippingAddress": {  // Null for PayOnly product type
        "name": "Susie Smith",
        "addressLine1": "10 Ditka Ave",
        "addressLine2": "Suite 2500",
        "addressLine3": null,
        "city": "Chicago",
        "county": null,
        "district": null,
        "stateOrRegion": "IL",
        "postalCode": "60602",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    "platformId": null,
    "chargePermissionId": null,
    "chargeId": null,
    "constraints": [
        {
            "constraintId": "ChargeAmountNotSet",
            "description": "chargeAmount is not set."
        },
        {
            "constraintId": "CheckoutResultReturnUrlNotSet",
            "description": "checkoutResultReturnUrl is not set."
        },
        {
            "constraintId": "PaymentIntentNotSet",
            "description": "paymentIntent is not set."
        }
    ],
    "creationTimestamp": "20191015T204313Z",
    "expirationTimestamp": "20191016T204313Z",
    "storeId": "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
    "deliverySpecifications": {
        "specialRestrictions": ["RestrictPOBoxes"],
        "addressRestrictions": {
            "type": "Allowed",
            "restrictions": {
                "US": {
                    "statesOrRegions": ["WA"],
                    "zipCodes": ["95050", "93405"]
                },
                "GB": {
                    "zipCodes": ["72046", "72047"]
                },
                "IN": {
                    "statesOrRegions": ["AP"]
                },
                "JP": {}
          }
        }
    },
    "providerMetadata": {
        "providerReferenceId": null
    },
    "checkoutButtonText": null,
    "releaseEnvironment": "Sandbox"
}
```

#### Error codes

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CA3tCf3'>
            <td id='s:ERL9CA3tCf3;ERL9CACltB2' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>HTTP status code
                <br /></td>
            <td id='s:ERL9CA3tCf3;ERL9CAzkjOM' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Reason code
                <br /></td>
            <td id='s:ERL9CA3tCf3;ERL9CAbhh9x' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CAtHu1q'>
            <td id='s:ERL9CAtHu1q;ERL9CACltB2' style='vertical-align: top;'><br>404 NOT_FOUND
                <br /></td>
            <td id='s:ERL9CAtHu1q;ERL9CAzkjOM' style='vertical-align: top;'><br>ResourceNotFound
                <br /></td>
            <td id='s:ERL9CAtHu1q;ERL9CAbhh9x' style='vertical-align: top;'>Checkout Session details are permanently deleted after 30 days. Any request on the Checkout Session will return this error code
                <br /></td>
        </tr>
    </tbody>
</table>

Generic errors can be found <a href="../amazon-pay-api-v2/error-handling.md" target="_blank" rel="noopener noreferrer">here</a>. 

### Update Checkout Session

Update the Checkout Session with transaction details. You can keep updating the Checkout Session until the buyer is redirected to `amazonPayRedirectUrl`. Once all mandatory parameters have been set, the Checkout Session object will respond with an unique `amazonPayRedirectUrl` that you will use to redirect the buyer to complete checkout.

Set `chargeAmount` to the value that should be processed using the `paymentIntent` during checkout. If you need to split the order to capture additional payment after checkout is complete, use the optional `totalOrderAmount` parameter to set the full order amount.


#### Request


<div style="display:none" class="environmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:version/checkoutSessions/:checkoutSessionId" \<br />
-X PATCH<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-d @request_body<br />
</code>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:environment/:version/checkoutSessions/:checkoutSessionId" \<br />
-X PATCH<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-d @request_body<br />
</code>
</div>

#### Request body

```
{
    "webCheckoutDetails": {
        "checkoutResultReturnUrl": "https://a.com/merchant-confirm-page"
    },
    "paymentDetails": {
        "paymentIntent": "AuthorizeWithCapture",
        "canHandlePendingAuthorization":false,
        "softDescriptor": "Descriptor",
        "chargeAmount": {
            "amount": "1",
            "currencyCode": "USD"
        }
     },
    "merchantMetadata": {
        "merchantReferenceId": "Merchant reference ID",
        "merchantStoreName": "Merchant store name",
        "noteToBuyer": "Note to buyer",
        "customInformation": "Custom information"
    }
}
```



#### Request parameters

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAipzsl'>
            <td id='s:ERL9CAipzsl;ERL9CAFccoh' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Name
                <br /></td>
            <td id='s:ERL9CAipzsl;ERL9CAjQdu4' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Location
                <br /></td>
            <td id='s:ERL9CAipzsl;ERL9CAxmCJ7' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CA4LMaA'>
            <td id='s:ERL9CA4LMaA;ERL9CAFccoh' style='vertical-align: top;'>checkoutSessionId<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAjQdu4' style='vertical-align: top;'>Path parameter
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAxmCJ7' style='vertical-align: top;'>Checkout Session identifier
                <br /></td>
        </tr>
        <tr id='ERL9CAvm2Or'>
            <td id='s:ERL9CAvm2Or;ERL9CAFccoh' style='vertical-align: top;'>webCheckoutDetails<br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-webcheckoutdetails" target="_blank" rel="noopener noreferrer">webCheckoutDetails</a>
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAxmCJ7' style='vertical-align: top;'>Checkout result URL provided by the merchant. Amazon Pay will redirect to this URL after completing the transaction<br><br>Modifiable: Multiple times before the buyer is redirected to the amazonPayReturnUrl
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>recurringMetadata<br /><br />Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-recurringmetadata" target="_blank" rel="noopener noreferrer">recurringMetadata</a>
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>Metadata about how the recurring Charge Permission will be used. Amazon Pay only uses this information to calculate the Charge Permission expiration date and in buyer communication<br /><br />
            Note that it is still your responsibility to call <a href="../amazon-pay-api-v2/charge.md#create-charge" target="_blank" rel="noopener noreferrer">Create Charge</a> to charge the buyer for each billing cycle
                <br /></td>
        </tr>
        <tr id='ERL9CAgQ4T4'>
            <td id='s:ERL9CAgQ4T4;ERL9CAFccoh' style='vertical-align: top;'>paymentDetails<br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-paymentdetails" target="_blank" rel="noopener noreferrer">paymentDetails</a>
                <br /></td>
            <td id='s:ERL9CAgQ4T4;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAgQ4T4;ERL9CAxmCJ7' style='vertical-align: top;'>Payment details specified by the merchant such as the amount and method for charging the buyer<br><br>Modifiable: Multiple times before the buyer is redirected to the <code>amazonPayReturnUrl</code>
                <br /></td>
        </tr>
        <tr id='ERL9CA6JHj6'>
            <td id='s:ERL9CA6JHj6;ERL9CAFccoh' style='vertical-align: top;'>merchantMetadata<br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-merchantmetadata" target="_blank" rel="noopener noreferrer">merchantMetadata</a>
                <br /></td>
            <td id='s:ERL9CA6JHj6;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CA6JHj6;ERL9CAxmCJ7' style='vertical-align: top;'>External order details provided by the merchant<br><br>Modifiable: Multiple times before the buyer is redirected to the <code>amazonPayReturnUrl</code>
                <br /></td>
        </tr>
        <tr id='ERL9CA7OsPD'>
            <td id='s:ERL9CA7OsPD;ERL9CAFccoh' style='vertical-align: top;'>platformId<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA7OsPD;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CA7OsPD;ERL9CAxmCJ7' style='vertical-align: top;'>Merchant identifier of the Solution Provider (SP). <br><br>Only SPs should use this field.<br><br>Modifiable: Multiple times before the buyer is redirected to the <code>amazonPayReturnUrl</code>.
                <br /></td>
        </tr>
        <tr id='ERL9CAuzzTA'>
            <td id='s:ERL9CAuzzTA;ERL9CAFccoh' style='vertical-align: top;'>providerMetadata<br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-providermetadata" target="_blank" rel="noopener noreferrer">providerMetadata</a>
                <br /></td>
            <td id='s:ERL9CAuzzTA;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAuzzTA;ERL9CAxmCJ7' style='vertical-align: top;'>Transaction identifier created by the Payment Service Provider (PSP)<br><br>Only PSPs should use these fields<br><br>Modifiable: Multiple times before the buyer is redirected to the <code>amazonPayReturnUrl</code>
                <br /></td>
        </tr>
    </tbody>
</table>

#### Sample Code

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-updateCheckoutSession" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-updateCheckoutSession" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-updateCheckoutSession" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-updateCheckoutSession" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-updateCheckoutSession">   
<div markdown="block">
```
<?php

    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );
        
    $payload = array(
        'webCheckoutDetails' => array(
            'checkoutResultReturnUrl' => 'https://a.com/merchant-confirm-page'
        ),
        'paymentDetails' => array(
            'paymentIntent' => 'AuthorizeWithCapture',
            'canHandlePendingAuthorization' => false,
            'softDescriptor' => 'Descriptor',
            'chargeAmount' => array(
                'amount' => '1',
                'currencyCode' => 'USD'
            )
        ),
        'merchantMetadata' => array(
            'merchantReferenceId' => 'Merchant reference ID',
            'merchantStoreName' => 'Merchant store name',
            'noteToBuyer' => 'Note to buyer',
            'customInformation' => 'Custom information'
        )
    );

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);

        $result = $client->updateCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', $payload);

        if ($result['status'] === 200) {
            
            $response = json_decode($result['response'], true);
            $amazonPayRedirectUrl = $response['webCheckoutDetails']['amazonPayRedirectUrl'];

        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'];
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-updateCheckoutSession">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore.CheckoutSession;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public CheckoutSessionResponse UpdateCheckoutSession(string checkoutSessionId)
    {
        // prepare the request
        var request = new UpdateCheckoutSessionRequest()
        {
            WebCheckoutDetails = {
                CheckoutResultReturnUrl = "https://a.com/merchant-confirm-page"
            },
            PaymentDetails = {
                ChargeAmount = {
                    Amount = 1.00M,
                    CurrencyCode = Currency.USD
                },
                CanHandlePendingAuthorization = false,
                SoftDescriptor = "Descriptor",
                PaymentIntent = PaymentIntent.AuthorizeWithCapture
            },
            MerchantMetadata = { 
                MerchantReferenceId = "Merchant reference ID", 
                MerchantStoreName = "Merchant store name", 
                NoteToBuyer = "Note to buyer",
                CustomInformation = "Custom information"
            }
        };

        // send the request
        var result = client.UpdateCheckoutSession(checkoutSessionId, request);

        // check if API call was successful
        if (!result.Success)
        {
            // do something, e.g. throw an error
        }

        return result;
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-updateCheckoutSession">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;
        String checkoutSessionId = "bd504926-f659-4ad7-a1a9-9a747aaf5275";

        JSONObject payload = new JSONObject();
        JSONObject updateWebCheckoutDetails = new JSONObject();
        updateWebCheckoutDetails.put("checkoutResultReturnUrl", "https://a.com/merchant-confirm-page");
        payload.put("webCheckoutDetails", updateWebCheckoutDetails);

        JSONObject paymentDetails = new JSONObject();
        paymentDetails.put("paymentIntent" , "AuthorizeWithCapture");
        paymentDetails.put("canHandlePendingAuthorization", false);
        paymentDetails.put("softDescriptor", "Descriptor");

        JSONObject chargeAmount = new JSONObject();
        chargeAmount.put("amount", "1");
        chargeAmount.put("currencyCode", "USD");
        paymentDetails.put("chargeAmount", chargeAmount);

        payload.put("paymentDetails", paymentDetails);

        JSONObject merchantMetadata = new JSONObject();
        merchantMetadata.put("merchantReferenceId", "Merchant reference ID");
        merchantMetadata.put("merchantStoreName", "Merchant store name");
        merchantMetadata.put("noteToBuyer", "Note to buyer");
        merchantMetadata.put("customInformation", "Custom information");
        payload.put("merchantMetadata", merchantMetadata);

        response = webstoreClient.updateCheckoutSession(checkoutSessionId, payload);
    } catch (AmazonPayClientException e) {
            e.printStackTrace();
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-updateCheckoutSession">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                
const payload = {
    webCheckoutDetails: {
        checkoutResultReturnUrl: "https://a.com/merchant-confirm-page"
    },
    paymentDetails: {
        paymentIntent: "AuthorizeWithCapture",
        canHandlePendingAuthorization: false,
        softDescriptor: "Descriptor",
        chargeAmount: {
            amount: "1",
            currencyCode: "USD"
        }
    },
    merchantMetadata: {
        merchantReferenceId: "Merchant reference ID",
        merchantStoreName: "Merchant store name",
        noteToBuyer: "Note to buyer",
        customInformation: "Custom information"
    }
};
                        
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.updateCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', payload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-updateCheckoutSession-NESK" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-updateCheckoutSession-NESK" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-updateCheckoutSession-NESK" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-updateCheckoutSession-NESK" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-updateCheckoutSession-NESK">   
<div markdown="block">
```
<?php

    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'sandbox'       => true,
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );
        
    $payload = array(
        'webCheckoutDetails' => array(
            'checkoutResultReturnUrl' => 'https://a.com/merchant-confirm-page'
        ),
        'paymentDetails' => array(
            'paymentIntent' => 'AuthorizeWithCapture',
            'canHandlePendingAuthorization' => false,
            'softDescriptor' => 'Descriptor',
            'chargeAmount' => array(
                'amount' => '1',
                'currencyCode' => 'USD'
            )
        ),
        'merchantMetadata' => array(
            'merchantReferenceId' => 'Merchant reference ID',
            'merchantStoreName' => 'Merchant store name',
            'noteToBuyer' => 'Note to buyer',
            'customInformation' => 'Custom information'
        )
    );

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);

        $result = $client->updateCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', $payload);

        if ($result['status'] === 200) {
            
            $response = json_decode($result['response'], true);
            $amazonPayRedirectUrl = $response['webCheckoutDetails']['amazonPayRedirectUrl'];

        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'];
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-updateCheckoutSession-NESK">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore.CheckoutSession;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            environment: Environment.Sandbox,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public CheckoutSessionResponse UpdateCheckoutSession(string checkoutSessionId)
    {
        // prepare the request
        var request = new UpdateCheckoutSessionRequest()
        {
            WebCheckoutDetails = {
                CheckoutResultReturnUrl = "https://a.com/merchant-confirm-page"
            },
            PaymentDetails = {
                ChargeAmount = {
                    Amount = 1.00M,
                    CurrencyCode = Currency.USD
                },
                CanHandlePendingAuthorization = false,
                SoftDescriptor = "Descriptor",
                PaymentIntent = PaymentIntent.AuthorizeWithCapture
            },
            MerchantMetadata = { 
                MerchantReferenceId = "Merchant reference ID", 
                MerchantStoreName = "Merchant store name", 
                NoteToBuyer = "Note to buyer",
                CustomInformation = "Custom information"
            }
        };

        // send the request
        var result = client.UpdateCheckoutSession(checkoutSessionId, request);

        // check if API call was successful
        if (!result.Success)
        {
            // do something, e.g. throw an error
        }

        return result;
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-updateCheckoutSession-NESK">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Environment;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setEnvironment(Environment.SANDBOX)
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;
        String checkoutSessionId = "bd504926-f659-4ad7-a1a9-9a747aaf5275";

        JSONObject payload = new JSONObject();
        JSONObject updateWebCheckoutDetails = new JSONObject();
        updateWebCheckoutDetails.put("checkoutResultReturnUrl", "https://a.com/merchant-confirm-page");
        payload.put("webCheckoutDetails", updateWebCheckoutDetails);

        JSONObject paymentDetails = new JSONObject();
        paymentDetails.put("paymentIntent" , "AuthorizeWithCapture");
        paymentDetails.put("canHandlePendingAuthorization", false);
        paymentDetails.put("softDescriptor", "Descriptor");

        JSONObject chargeAmount = new JSONObject();
        chargeAmount.put("amount", "1");
        chargeAmount.put("currencyCode", "USD");
        paymentDetails.put("chargeAmount", chargeAmount);

        payload.put("paymentDetails", paymentDetails);

        JSONObject merchantMetadata = new JSONObject();
        merchantMetadata.put("merchantReferenceId", "Merchant reference ID");
        merchantMetadata.put("merchantStoreName", "Merchant store name");
        merchantMetadata.put("noteToBuyer", "Note to buyer");
        merchantMetadata.put("customInformation", "Custom information");
        payload.put("merchantMetadata", merchantMetadata);

        response = webstoreClient.updateCheckoutSession(checkoutSessionId, payload);
    } catch (AmazonPayClientException e) {
            e.printStackTrace();
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-updateCheckoutSession-NESK">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    sandbox: true,
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                
const payload = {
    webCheckoutDetails: {
        checkoutResultReturnUrl: "https://a.com/merchant-confirm-page"
    },
    paymentDetails: {
        paymentIntent: "AuthorizeWithCapture",
        canHandlePendingAuthorization: false,
        softDescriptor: "Descriptor",
        chargeAmount: {
            amount: "1",
            currencyCode: "USD"
        }
    },
    merchantMetadata: {
        merchantReferenceId: "Merchant reference ID",
        merchantStoreName: "Merchant store name",
        noteToBuyer: "Note to buyer",
        customInformation: "Custom information"
    }
};
                        
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.updateCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', payload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>

#### Response

Returns <a href="https://restfulapi.net/http-status-200-ok" target="_blank" rel="noopener noreferrer">HTTP 200 status response code</a> if the operation was successful.

```
{
    "checkoutSessionId": "bd504926-f659-4ad7-a1a9-9a747aaf5275",
    "webCheckoutDetails": {
        "checkoutReviewReturnUrl": "https://a.com/merchant-review-page",
        "checkoutResultReturnUrl": "https://a.com/merchant-confirm-page",
        "checkoutCancelUrl": null,
        "amazonPayRedirectUrl": "https://pay.amazon.com/redirect/checkoutId-1"
    },
    "productType": "PayAndShip",
    "paymentDetails": {
        "paymentIntent": "AuthorizeWithCapture",
        "canHandlePendingAuthorization": false,
        "chargeAmount": {
            "amount": "1",
            "currencyCode": "USD"
        },
        "totalOrderAmount": null,
        "softDescriptor": "Descriptor",
        "presentmentCurrency": "USD",
        "allowOvercharge": null,
        "extendExpiration": null
    },
    "merchantMetadata": {
        "merchantReferenceId": "Merchant reference ID",
        "merchantStoreName": "Merchant store name",
        "noteToBuyer": "Note to buyer",
        "customInformation": "Custom information"
    },
    "supplementaryData": null, // Amazon Pay system data 
    "buyer": {
        "buyerId": "buyerId",
        "name": "name-1",
        "email": "name@amazon.com",
        "phoneNumber": "800-000-0000",
        "primeMembershipTypes": null
    },
    "billingAddress":{ 
        "name": "Work",
        "addressLine1": "440 Terry Ave",
        "addressLine2": "",
        "addressLine3": "",
        "city": "Seattle",
        "county": "King",    
        "district": "Seattle",
        "stateOrRegion": "WA",
        "postalCode": "98121",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    "paymentPreferences": [
        {
            "paymentDescriptor": "Visa ****1111 (Amazon Pay)"
        }
    ],
    "statusDetails": {
        "state": "Open",
        "reasonCode": null,
        "reasonDescription": null,
        "lastUpdatedTimestamp": "20191015T195703Z"
    },
    "shippingAddress": {  // Null for PayOnly product type
        "name": "Susie Smith",
        "addressLine1": "10 Ditka Ave",
        "addressLine2": "Suite 2500",
        "addressLine3": null,
        "city": "Chicago",
        "county": null,
        "district": null,
        "stateOrRegion": "IL",
        "postalCode": "60602",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    "platformId": null,
    "chargePermissionId": null,
    "chargeId": null,
    "constraints": [],
    "creationTimestamp": "20191015T195655Z",
    "expirationTimestamp": "20191016T195655Z",
    "storeId": "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
    "deliverySpecifications": {
        "specialRestrictions": ["RestrictPOBoxes"],
        "addressRestrictions": {
            "type": "Allowed",
            "restrictions": {
                "US": {
                    "statesOrRegions": ["WA"],
                    "zipCodes": ["95050", "93405"]
                },
                "GB": {
                    "zipCodes": ["72046", "72047"]
                },
                "IN": {
                    "statesOrRegions": ["AP"]
                },
                "JP": {}
            }
        }
    },
    "providerMetadata": {
        "providerReferenceId": null
    },
    "checkoutButtonText": null,
    "releaseEnvironment": "Sandbox"
}
```

#### Error codes 

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CA9q0ob'>
            <td id='s:ERL9CA9q0ob;ERL9CADTh10' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>HTTP status code
                <br /></td>
            <td id='s:ERL9CA9q0ob;ERL9CAq22MQ' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Reason code
                <br /></td>
            <td id='s:ERL9CA9q0ob;ERL9CAFbHzY' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CASmvZN'>
            <td id='s:ERL9CASmvZN;ERL9CADTh10' style='vertical-align: top;'><br>404 NOT_FOUND
                <br /></td>
            <td id='s:ERL9CASmvZN;ERL9CAq22MQ' style='vertical-align: top;'><br>ResourceNotFound
                <br /></td>
            <td id='s:ERL9CASmvZN;ERL9CAFbHzY' style='vertical-align: top;'>Checkout Session details are permanently deleted after 30 days. Any request on the Checkout Session will return this error code
                <br /></td>
        </tr>
        <tr id='ERL9CA7wecp'>
            <td id='s:ERL9CA7wecp;ERL9CADTh10' style='vertical-align: top;'><br>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:ERL9CA7wecp;ERL9CAq22MQ' style='vertical-align: top;'>InvalidCheckoutSessionStatus
                <br /></td>
            <td id='s:ERL9CA7wecp;ERL9CAFbHzY' style='vertical-align: top;'>You tried to call an operation on a Checkout Session that is in a state where that operation is not allowed
                <br /></td>
        </tr>
    </tbody>
</table>

Generic errors can be found <a href="../amazon-pay-api-v2/error-handling.md" target="_blank" rel="noopener noreferrer">here</a>. 

### Complete Checkout Session

<div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> Complete Checkout Session is required for all checkout or payment flows other than Amazon Pay Buy Now. If you are integrating Buy Now, please use Finalize Checkout Session.</div>

Complete Checkout Session after the buyer returns to `checkoutResultReturnUrl` to finalize the `paymentIntent`. The `chargeAmount` in the request must match the Checkout Session object `paymentDetails.chargeAmount` to verify the transaction amount. 

This request returns <a href="https://restfulapi.net/http-status-202-accepted/" target="_blank" rel="noopener noreferrer">HTTP 202 status response code</a>  if `canHandlePendingAuthorization` was set to true and the authorization is still pending. If the authorization result has been determined, this request will return a <a href="https://restfulapi.net/http-status-200-ok" target="_blank" rel="noopener noreferrer">HTTP 200 status response code</a> if the authorization was successful or a 4xx/5xx response if authorization failed. See <a href="../amazon-pay-checkout/asynchronous-processing.md">asynchronous processing</a> for more info. 


#### Request


<div style="display:none" class="environmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:version/checkoutSessions/:checkoutSessionId/complete" \<br />
-X POST<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-d @request_body<br />
</code>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:environment/:version/checkoutSessions/:checkoutSessionId/complete" \<br />
-X POST<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-H "x-amz-pay-idempotency-key:AVLo5tI10BHgEk2jEXAMPLEKEY"<br />
-d @request_body<br />
</code>
</div>

#### Request body

```
{
    "chargeAmount": {
        "amount": "14.00",
        "currencyCode": "USD"
    }
}
```



#### Request parameters

<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAipzsl'>
            <td id='s:ERL9CAipzsl;ERL9CAFccoh' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Name
                <br /></td>
            <td id='s:ERL9CAipzsl;ERL9CAjQdu4' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Location
                <br /></td>
            <td id='s:ERL9CAipzsl;ERL9CAxmCJ7' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CA4LMaA'>
            <td id='s:ERL9CA4LMaA;ERL9CAFccoh' style='vertical-align: top;'>checkoutSessionId<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAjQdu4' style='vertical-align: top;'>Path parameter
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAxmCJ7' style='vertical-align: top;'>Checkout Session identifier
                <br /></td>
        </tr>
        <tr id='ERL9CAvm2Or'>
            <td id='s:ERL9CAvm2Or;ERL9CAFccoh' style='vertical-align: top;'>chargeAmount<br><b>(required)</b><br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-price" target="_blank" rel="noopener noreferrer">price</a>
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAxmCJ7' style='vertical-align: top;'>Amount to be processed using <code>paymentIntent</code> during checkout. Must match Checkout Session object <code>paymentDetails.chargeAmount</code>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>totalOrderAmount<br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-price" target="_blank" rel="noopener noreferrer">price</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>Total order amount. Must match Checkout Session object <code>paymentDetails.totalOrderAmount</code> if a value was provided
                <br /></td>
        </tr>
    </tbody>
</table>

#### Sample Code

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-completeCheckoutSession" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-completeCheckoutSession" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-completeCheckoutSession" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-completeCheckoutSession" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-completeCheckoutSession">   
<div markdown="block">
```
<?php

    include 'vendor/autoload.php';
    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );

    $payload = array(
        'chargeAmount' => array(
            'amount' => '14.00',
            'currencyCode' => 'USD'
        )
    );

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->completeCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', $payload);
        
        if ($result['status'] === 202) {
            // Charge Permission is in AuthorizationInitiated state
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargeId = $response['chargeId'];
            $chargePermissionId = $response['chargePermissionId'];
        } 
        else if ($result['status'] === 200) {
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargePermissionId = $response['chargePermissionId'];
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-completeCheckoutSession">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.CheckoutSession;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public CheckoutSessionResponse CompleteCheckoutSession(string checkoutSessionId)
    {
        // prepare the request
        var request = new CompleteCheckoutSessionRequest(14.00M, Currency.USD);

        // send the request
        var result = client.CompleteCheckoutSession(checkoutSessionId, request);

        // check if API call was successful
        if (!result.Success)
        {
            // do something, e.g. throw an error
        }

        return result;
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-completeCheckoutSession">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;
        String checkoutSessionId = "bd504926-f659-4ad7-a1a9-9a747aaf5275";

        JSONObject payload = new JSONObject();

        JSONObject chargeAmount = new JSONObject();
        chargeAmount.put("amount", "14.00");
        chargeAmount.put("currencyCode", "USD");
        payload.put("chargeAmount", chargeAmount);

        response = webstoreClient.completeCheckoutSession(checkoutSessionId, payload);
        String chargePermissionId = response.getResponse().getString("chargePermissionId");
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }
}

```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-completeCheckoutSession">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                
const payload = {
    chargeAmount: {
        amount: "14.00",
        currencyCode: "USD"
    }
};
                        
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.completeCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', payload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-completeCheckoutSession-NESK" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-completeCheckoutSession-NESK" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-completeCheckoutSession-NESK" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-completeCheckoutSession-NESK" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-completeCheckoutSession-NESK">   
<div markdown="block">
```
<?php

    include 'vendor/autoload.php';
    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'sandbox'       => true,
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );

    $payload = array(
        'chargeAmount' => array(
            'amount' => '14.00',
            'currencyCode' => 'USD'
        )
    );

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->completeCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', $payload);
        
        if ($result['status'] === 202) {
            // Charge Permission is in AuthorizationInitiated state
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargeId = $response['chargeId'];
            $chargePermissionId = $response['chargePermissionId'];
        } 
        else if ($result['status'] === 200) {
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargePermissionId = $response['chargePermissionId'];
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }
?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-completeCheckoutSession-NESK">
<div markdown="block">
```
using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.CheckoutSession;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            environment: Environment.Sandbox,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public CheckoutSessionResponse CompleteCheckoutSession(string checkoutSessionId)
    {
        // prepare the request
        var request = new CompleteCheckoutSessionRequest(14.00M, Currency.USD);

        // send the request
        var result = client.CompleteCheckoutSession(checkoutSessionId, request);

        // check if API call was successful
        if (!result.Success)
        {
            // do something, e.g. throw an error
        }

        return result;
    }
}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-completeCheckoutSession-NESK">
<div markdown="block">
```
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Environment;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
            .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
            .setRegion(Region.YOUR_REGION_CODE)
            .setPrivateKey("YOUR_PRIVATE_KEY")
            .setEnvironment(Environment.SANDBOX)
            .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;
        String checkoutSessionId = "bd504926-f659-4ad7-a1a9-9a747aaf5275";

        JSONObject payload = new JSONObject();

        JSONObject chargeAmount = new JSONObject();
        chargeAmount.put("amount", "14.00");
        chargeAmount.put("currencyCode", "USD");
        payload.put("chargeAmount", chargeAmount);

        response = webstoreClient.completeCheckoutSession(checkoutSessionId, payload);
        String chargePermissionId = response.getResponse().getString("chargePermissionId");
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }
}

```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-completeCheckoutSession-NESK">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    sandbox: true,
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2' 
};    
                
const payload = {
    chargeAmount: {
        amount: "14.00",
        currencyCode: "USD"
    }
};
                        
const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.completeCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', payload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>
</div>

#### Response

Returns <a href="https://restfulapi.net/http-status-200-ok" target="_blank" rel="noopener noreferrer">HTTP 200 status response code</a> if `paymentIntent` was successful. Returns <a href="https://restfulapi.net/http-status-202-accepted/" target="_blank" rel="noopener noreferrer">HTTP 202 status response code</a> if authorization is still pending.

```
{
    "checkoutSessionId": "bd504926-f659-4ad7-a1a9-9a747aaf5275",
    "webCheckoutDetails": null,
    "chargePermissionType": "OneTime",   
    "recurringMetadata": null,
    "productType": null,
    "paymentDetails": null,
    "merchantMetadata": null,
    "supplementaryData":null, // Amazon Pay system data 
    "buyer": null,
    "billingAddress": null,
    "paymentPreferences": [
        null
    ],
    "statusDetails": {
        "state": "Completed",
        "reasonCode": null,
        "reasonDescription": null,
        "lastUpdatedTimestamp": "20191015T204327Z"
    },
    "shippingAddress": null,
    "platformId":null,
    "chargePermissionId": "S01-5105180-3221187",
    "chargeId": "S01-5105180-3221187-C056351",
    "constraints": [
        null
    ],
    "creationTimestamp": "20191015T204313Z",
    "expirationTimestamp": null,
    "storeId": null,
    "deliverySpecifications": null,
    "providerMetadata": null,
    "checkoutButtonText": null,
    "releaseEnvironment": null
}
```

#### Error codes 

<table width="100%" border="1">
    <tbody>
        <tr id='RRV9CAAwEhs'>
            <td id='s:ERL9CA9q0ob;ERL9CADTh10' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>HTTP status code
                <br /></td>
            <td id='s:ERL9CA9q0ob;ERL9CAq22MQ' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Reason code
                <br /></td>
            <td id='s:ERL9CA9q0ob;ERL9CAFbHzY' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'><br>400 BAD_REQUEST
                <br /></td>
            <td id='' style='vertical-align: top;'><br>CurrencyMismatch
                <br /></td>
            <td id='' style='vertical-align: top;'>The currency code provided in the request does not match the currency set during checkout
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'><br>400 BAD_REQUEST
                <br /></td>
            <td id='' style='vertical-align: top;'><br>TransactionAmountExceeded
                <br /></td>
            <td id='' style='vertical-align: top;'>You've exceeded the maximum charge amount allowed for the Checkout Session
                <br /></td>
        </tr>
        <tr id='RRV9CApF183'>
            <td id='s:RRV9CApF183;RRV9CADEXUO' style='vertical-align: top;'><br>404 NOT_FOUND
                <br /></td>
            <td id='s:RRV9CApF183;RRV9CADSdxj' style='vertical-align: top;'><br>ResourceNotFound
                <br /></td>
            <td id='s:RRV9CApF183;RRV9CAxD9sC' style='vertical-align: top;'>Checkout Session details are permanently deleted after 30 days. Any request on the Checkout Session will return this error code
                <br /></td>
        </tr>
        <tr id='RRV9CAFTKSt'>
            <td id='s:RRV9CAFTKSt;RRV9CADEXUO' style=''>409 CONFLICT
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CADSdxj' style=''>AmountMismatch
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CAxD9sC' style=''>Mismatch between Checkout Session object <code>chargeAmount</code> and the request <code>chargeAmount</code>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'><br>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='' style='vertical-align: top;'><br>CheckoutSessionCanceled
                <br /></td>
            <td id='' style='vertical-align: top;'>Checkout was unsuccessful because the buyer cancelled the transaction or payment was declined
                <br /></td>
        </tr>
        <tr id='RRV9CApBW84'>
            <td id='s:RRV9CApBW84;RRV9CADEXUO' style='vertical-align: top;'><br>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CApBW84;RRV9CADSdxj' style='vertical-align: top;'>InvalidCheckoutSessionStatus
                <br /></td>
            <td id='s:RRV9CApBW84;RRV9CAxD9sC' style='vertical-align: top;'>You tried to call an operation on a Checkout Session that is in a state where that operation is not allowed
                <br /></td>
        </tr>
        <tr id='RRV9CApBW84'>
            <td id='s:RRV9CApBW84;RRV9CADEXUO' style='vertical-align: top;'><br>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CApBW84;RRV9CADSdxj' style='vertical-align: top;'>InvalidChargeStatus
                <br /></td>
            <td id='s:RRV9CApBW84;RRV9CAxD9sC' style='vertical-align: top;'>You tried to call an operation on a Charge that is in a state where that operation is not allowed or you tried to Complete Checkout Session on a Checkout Session with <code>paymentIntent</code> set to AuthorizeWithCapture and <code>canHandlePendingAuthorization</code> set to true
                <br /></td>
        </tr>
        <tr id='RRV9CARZv8O'>
            <td id='s:RRV9CARZv8O;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CARZv8O;RRV9CADSdxj' style='vertical-align: top;'>HardDeclined
                <br /></td>
            <td id='s:RRV9CARZv8O;RRV9CAxD9sC' style='vertical-align: top;'>Charge was hard declined. Retry attemps will not succeed. Please contact the buyer and have them choose a different payment instrument
                <br /></td>
        </tr>
        <tr id='RRV9CADgbCA'>
            <td id='s:RRV9CADgbCA;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CADgbCA;RRV9CADSdxj' style='vertical-align: top;'>PaymentMethodNotAllowed
                <br /></td>
            <td id='s:RRV9CADgbCA;RRV9CAxD9sC' style='vertical-align: top;'>The payment method selected by the buyer is not allowed for this charge
                <br /></td>
        </tr>
        <tr id='RRV9CAUzZgT'>
            <td id='s:RRV9CAUzZgT;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CAUzZgT;RRV9CADSdxj' style='vertical-align: top;'>AmazonRejected
                <br /></td>
            <td id='s:RRV9CAUzZgT;RRV9CAxD9sC' style='vertical-align: top;'>Charge was declined by Amazon. The associated Charge Permission will also be canceled
                <br /></td>
        </tr>
        <tr id='RRV9CAY9tT2'>
            <td id='s:RRV9CAY9tT2;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CAY9tT2;RRV9CADSdxj' style='vertical-align: top;'>MFANotCompleted
                <br /></td>
            <td id='s:RRV9CAY9tT2;RRV9CAxD9sC' style='vertical-align: top;'>Multi-factor authentication (MFA) is required to be complete by the buyer for this transaction to process
                <br /></td>
        </tr>
        <tr id='RRV9CAm8slJ'>
            <td id='s:RRV9CAm8slJ;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CAm8slJ;RRV9CADSdxj' style='vertical-align: top;'>TransactionTimedOut
                <br /></td>
            <td id='s:RRV9CAm8slJ;RRV9CAxD9sC' style='vertical-align: top;'>If you set <code>canHandlePendingAuthorization</code> to false, the Charge was declined because Amazon Pay did not have enough time to process the authorization. Contact the buyer and have them choose another payment method. If you frequently encounter this decline, consider setting <code>canHandlePendingAuthorization</code> to true<br><br>If you set <code>canHandlePendingAuthorization</code> to true, the Charge was declined because Amazon Pay was unable to determine the validity of the order. Contact the buyer and have them choose another payment method. See <a href="https://pay.amazon.com">asynchronous processing </a>for more information
                <br /></td>
        </tr>
        <tr id='RRV9CA59kyj'>
            <td id='s:RRV9CA59kyj;RRV9CADEXUO' style='vertical-align: top;'>500 INTERNAL_SERVER_ERROR
                <br /></td>
            <td id='s:RRV9CA59kyj;RRV9CADSdxj' style='vertical-align: top;'>ProcessingFailure
                <br /></td>
            <td id='s:RRV9CA59kyj;RRV9CAxD9sC' style='vertical-align: top;'>Amazon could not process the Charge because of an internal processing error. You should retry the charge only if the Charge Permission is in the Chargeable state
                <br /></td>
        </tr>
    </tbody>
</table>

Generic errors can be found <a href="../amazon-pay-api-v2/error-handling.md" target="_blank" rel="noopener noreferrer">here</a>. 

### Finalize Checkout Session

<div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> Finalize Checkout Session is only required for an Amazon Pay Buy Now integration. If you are integrating any other checkout or payment flow, please use Complete Checkout Session.</div>

Finalize Checkout Session after your `onCompleteCheckout` event handler was invoked to finalize the `paymentIntent`. 
The `chargeAmount` in the request must match the Checkout Session object `paymentDetails.chargeAmount` to verify order amount. You must also specify `totalOrderAmount` and `supplementaryData` if one was provided for the Checkout Session. For `PayAndShip` use cases, the `shippingAddress` is also required and must match the address shared by Amazon. For `PayOnly` use cases, the same requirement exists for the `billingAddress`.

This request returns <a href="https://restfulapi.net/http-status-202-accepted/" target="_blank" rel="noopener noreferrer">HTTP 202 status response code</a>  if `canHandlePendingAuthorization` was set to true and the authorization is still pending. If the authorization result has been determined, this request will return a <a href="https://restfulapi.net/http-status-200-ok" target="_blank" rel="noopener noreferrer">HTTP 200 status response code</a> if the authorization was successful or a 4xx/5xx response if authorization failed. See <a href="../amazon-pay-checkout/asynchronous-processing.md">asynchronous processing</a> for more info.

#### Request

<div style="display:none" class="environmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:version/checkoutSessions/:checkoutSessionId/finalize" \<br />
-X POST<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-d @request_body<br />
</code>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<code style="color:black">
curl "https://pay-api.amazon.com/:environment/:version/checkoutSessions/:checkoutSessionId/finalize" \<br />
-X POST<br />
-H "authorization:Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"<br />
-H "x-amz-pay-date:20201012T235046Z"<br />
-H "x-amz-pay-idempotency-key:AVLo5tI10BHgEk2jEXAMPLEKEY"<br />
-d @request_body<br />
</code>
</div>

#### Request body

```JSON
{
    "shippingAddress": {
        "name": "Susy S",
        "addressLine1": "11 Ditka Ave",
        "addressLine2": "Suite 2500",
        "city": "Chicago",
        "county": null,
        "district": null,
        "stateOrRegion": "IL",
        "postalCode": "60602",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    "billingAddress": {
        "name": "Susy S",
        "addressLine1": "11 Ditka Ave",
        "addressLine2": "Suite 2500",
        "city": "Chicago",
        "county": null,
        "district": null,
        "stateOrRegion": "IL",
        "postalCode": "60602",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    {
    "chargeAmount": {
        "amount": "14",
        "currencyCode": "USD"
    },
    "totalOrderAmount": {
        "amount": "14",
        "currencyCode": "USD"
    },
    "paymentIntent": "AuthorizeWithCapture",
    "canHandlePendingAuthorization": "false"
}
```



#### Request parameters


<table width="100%" border="1">
    <tbody>
        <tr id='ERL9CAipzsl'>
            <td id='s:ERL9CAipzsl;ERL9CAFccoh' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Name
                <br /></td>
            <td id='s:ERL9CAipzsl;ERL9CAjQdu4' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Location
                <br /></td>
            <td id='s:ERL9CAipzsl;ERL9CAxmCJ7' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='ERL9CA4LMaA'>
            <td id='s:ERL9CA4LMaA;ERL9CAFccoh' style='vertical-align: top;'>checkoutSessionId<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAjQdu4' style='vertical-align: top;'>Path parameter
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAxmCJ7' style='vertical-align: top;'>Checkout Session identifier
                <br /></td>
        </tr>
        <tr id='ERL9CA4LMaA'>
            <td id='s:ERL9CA4LMaA;ERL9CAFccoh' style='vertical-align: top;'>paymentIntent<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAxmCJ7' style='vertical-align: top;'>Payment flow for charging the buyer
                <br /></td>
        </tr>
        <tr id='ERL9CAvm2Or'>
            <td id='s:ERL9CAvm2Or;ERL9CAFccoh' style='vertical-align: top;'>chargeAmount<br><b>(required)</b><br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-price" target="_blank" rel="noopener noreferrer">price</a>
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAxmCJ7' style='vertical-align: top;'>Amount to be processed using <code>paymentIntent</code> during checkout. Must match Checkout Session object <code>paymentDetails.chargeAmount</code>
                <br /></td>
        </tr>
        <tr id='ERL9CA4LMaA'>
            <td id='s:ERL9CA4LMaA;ERL9CAFccoh' style='vertical-align: top;'>canHandlePendingAuthorization<br><br>Type: boolean
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAlQj26;ERL9CAxLjJC' style='vertical-align: top;'>Boolean that indicates whether merchant can handle pending response <br><br>See <a href="../amazon-pay-checkout/v1-asynchronous-processing.md">asynchronous processing</a> for more info
                <br /></td>
        </tr>            
        <tr id='ERL9CA4LMaA'>
            <td id='s:ERL9CA4LMaA;ERL9CAFccoh' style='vertical-align: top;'>shippingAddress<br><b>(required*)</b><br><br>Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-address">address</a>
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAxmCJ7' style='vertical-align: top;'>Shipping address provided by Amazon for validation
                <br /><br /><b>*required</b> for `PayAndShip` use cases</td>
        </tr>
        <tr id='ERL9CA4LMaA'>
            <td id='s:ERL9CA4LMaA;ERL9CAFccoh' style='vertical-align: top;'>supplementaryData<br><br>Type: string
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CA4LMaA;ERL9CAxmCJ7' style='vertical-align: top;'>Supplementary data about your order
                <br /></td>
        </tr>
    </tbody>
</table>

#### Sample Code

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-completeCheckoutSession" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-completeCheckoutSession" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-completeCheckoutSession" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-completeCheckoutSession" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-completeCheckoutSession">   
<div markdown="block">
```php
<?php

    include 'vendor/autoload.php';
    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );

    $payload = array(
        'shippingAddress' => array(
            'name' => 'Susi S',
            'addressLine1' => '11 Ditka Ave',
            'addressLine2'=> 'Suite 2500',
            'city'=> 'Chicago',
            'stateOrRegion'=> 'IL',
            'postalCode'=> '60602',
            'countryCode'=> 'US',
            'phoneNumber'=> '800-000-0000'
        ),
        'chargeAmount' => array(
            'amount' => '14.00',
            'currencyCode' => 'USD'
        ),
        'paymentIntent' => 'AuthorizeWithCapture'
    );

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->finalizeCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', $payload);

        if ($result['status'] === 202) {
            // Charge Permission is in AuthorizationInitiated state
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargeId = $response['chargeId'];
            $chargePermissionId = $response['chargePermissionId'];
        }
        else if ($result['status'] === 200) {
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargePermissionId = $response['chargePermissionId'];
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }

?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-completeCheckoutSession">
<div markdown="block">
```csharp

using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.CheckoutSession;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
        region: Region.YOUR_REGION_CODE,
        publicKeyId: "YOUR_PUBLIC_KEY_ID",
        privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
        algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public CheckoutSessionResponse FinalizeCheckoutSession(string checkoutSessionId, Address shippingAddress, String paymentIntent)
    {
        // prepare the request
        var request = new FinalizeCheckoutSessionRequest(14.00M, Currency.USD, paymentIntent);
        request.ShippingAddress = address;

        // send the request
        var result = client.FinalizeCheckoutSession(checkoutSessionId, request);

        // check if API call was successful
        if (!result.Success)
        {
            // do something, e.g. throw an error
        }

        return result;
    }

}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-completeCheckoutSession">
<div markdown="block">
```Java
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
        .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
        .setRegion(Region.YOUR_REGION_CODE)
        .setPrivateKey("YOUR_PRIVATE_KEY")
        .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;
        String checkoutSessionId = "bd504926-f659-4ad7-a1a9-9a747aaf5275";

        JSONObject payload = new JSONObject();

        JSONObject chargeAmount = new JSONObject();
        chargeAmount.put("amount", "14.00");
        chargeAmount.put("currencyCode", "USD");
        payload.put("chargeAmount", chargeAmount);

        JSONObject shippingAddress = new JSONObject();
        shippingAddress.put("name", "Susy S");
        shippingAddress.put("addressLine1", "11 Ditka Ave");
        shippingAddress.put("addressLine2", "Suite 2500");
        shippingAddress.put("city", "Chicago");
        shippingAddress.put("stateOrRegion", "IL");
        shippingAddress.put("postalCode", "60602");
        shippingAddress.put("countryCode", "US");
        shippingAddress.put("phoneNumber", "800-000-0000");
        payload.put("shippingAddress", shippingAddress);

        payload.put("paymentIntent", "AuthorizeWithCapture");

        response = webstoreClient.finalizeCheckoutSession(checkoutSessionId, payload);
        String chargePermissionId = response.getResponse().getString("chargePermissionId");
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }

}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-completeCheckoutSession">
<div markdown="block">
```JavaScript
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2'
};

const payload = {
    chargeAmount: {
        amount: "14.00",
        currencyCode: "USD"
    },
    shippingAddress: {
        "name": "Susy S",
        "addressLine1": "11 Ditka Ave",
        "addressLine2": "Suite 2500",
        "city": "Chicago",
        "stateOrRegion": "IL",
        "postalCode": "60602",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    paymentIntent: "AuthorizeWithCapture",
};

const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.finalizeCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', payload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>

</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab-completeCheckoutSession-NESK" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab-completeCheckoutSession-NESK" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab-completeCheckoutSession-NESK" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab-completeCheckoutSession-NESK" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab-completeCheckoutSession-NESK">   
<div markdown="block">
```php
<?php

    include 'vendor/autoload.php';
    $amazonpay_config = array(
        'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem', // Path to RSA Private Key (or a string representation)
        'region'        => 'YOUR_REGION_CODE',
        'sandbox'       => true,
        'algorithm'     => 'AMZN-PAY-RSASSA-PSS-V2'
    );

    $payload = array(
        'shippingAddress' => array(
            'name' => 'Susi S',
            'addressLine1' => '11 Ditka Ave',
            'addressLine2'=> 'Suite 2500',
            'city'=> 'Chicago',
            'stateOrRegion'=> 'IL',
            'postalCode'=> '60602',
            'countryCode'=> 'US',
            'phoneNumber'=> '800-000-0000'
        ),
        'chargeAmount' => array(
            'amount' => '14.00',
            'currencyCode' => 'USD'
        ),
        'paymentIntent' => 'AuthorizeWithCapture'
    );

    try {
        $client = new Amazon\Pay\API\Client($amazonpay_config);
        $result = $client->finalizeCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', $payload);

        if ($result['status'] === 202) {
            // Charge Permission is in AuthorizationInitiated state
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargeId = $response['chargeId'];
            $chargePermissionId = $response['chargePermissionId'];
        }
        else if ($result['status'] === 200) {
            $response = json_decode($result['response'], true);
            $checkoutSessionState = $response['statusDetails']['state'];
            $chargePermissionId = $response['chargePermissionId'];
        } else {
            // check the error
            echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
        }
    } catch (Exception $e) {
        // handle the exception
        echo $e;
    }

?>
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab-completeCheckoutSession-NESK">
<div markdown="block">
```csharp

using Amazon.Pay.API.Types;
using Amazon.Pay.API.WebStore;
using Amazon.Pay.API.WebStore.Types;
using Amazon.Pay.API.WebStore.CheckoutSession;

public class Sample
{
    public WebStoreClient InitiateClient()
    {
        // set up config
        var payConfiguration = new ApiConfiguration
        (
            region: Region.YOUR_REGION_CODE,
            environment: Environment.Sandbox,
            publicKeyId: "YOUR_PUBLIC_KEY_ID",
            privateKey: "PATH_OR_CONTENT_OF_YOUR_PRIVATE_KEY",
            algorithm: AmazonSignatureAlgorithm.V2
        );

        // init API client
        var client = new WebStoreClient(payConfiguration);

        return client;
    }

    public CheckoutSessionResponse FinalizeCheckoutSession(string checkoutSessionId, Address shippingAddress, String paymentIntent)
    {
        // prepare the request
        var request = new FinalizeCheckoutSessionRequest(14.00M, Currency.USD, paymentIntent);
        request.ShippingAddress = address;

        // send the request
        var result = client.FinalizeCheckoutSession(checkoutSessionId, request);

        // check if API call was successful
        if (!result.Success)
        {
            // do something, e.g. throw an error
        }

        return result;
    }

}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab-completeCheckoutSession-NESK">
<div markdown="block">
```Java
import com.amazon.pay.api.AmazonPayResponse;
import com.amazon.pay.api.PayConfiguration;
import com.amazon.pay.api.WebstoreClient;
import com.amazon.pay.api.exceptions.AmazonPayClientException;
import com.amazon.pay.api.types.Region;

import org.json.JSONObject;

public void sample() {
    PayConfiguration payConfiguration = null;
    try {
        payConfiguration = new PayConfiguration()
        .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
        .setRegion(Region.YOUR_REGION_CODE)
        .setPrivateKey("YOUR_PRIVATE_KEY")
        .setEnvironment(Environment.SANDBOX)
        .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");

        WebstoreClient webstoreClient = new WebstoreClient(payConfiguration);
        AmazonPayResponse response = null;
        String checkoutSessionId = "bd504926-f659-4ad7-a1a9-9a747aaf5275";

        JSONObject payload = new JSONObject();

        JSONObject chargeAmount = new JSONObject();
        chargeAmount.put("amount", "14.00");
        chargeAmount.put("currencyCode", "USD");
        payload.put("chargeAmount", chargeAmount);

        JSONObject shippingAddress = new JSONObject();
        shippingAddress.put("name", "Susy S");
        shippingAddress.put("addressLine1", "11 Ditka Ave");
        shippingAddress.put("addressLine2", "Suite 2500");
        shippingAddress.put("city", "Chicago");
        shippingAddress.put("stateOrRegion", "IL");
        shippingAddress.put("postalCode", "60602");
        shippingAddress.put("countryCode", "US");
        shippingAddress.put("phoneNumber", "800-000-0000");
        payload.put("shippingAddress", shippingAddress);

        payload.put("paymentIntent", "AuthorizeWithCapture");

        response = webstoreClient.finalizeCheckoutSession(checkoutSessionId, payload);
        String chargePermissionId = response.getResponse().getString("chargePermissionId");
    } catch (AmazonPayClientException e) {
        e.printStackTrace();
    }

}
```

</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab-completeCheckoutSession-NESK">
<div markdown="block">
```JavaScript
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');

const config = {
    publicKeyId: 'YOUR_PUBLIC_KEY_ID',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'YOUR_REGION_CODE',
    sandbox: true,
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2'
};

const payload = {
    chargeAmount: {
        amount: "14.00",
        currencyCode: "USD"
    },
    shippingAddress: {
        "name": "Susy S",
        "addressLine1": "11 Ditka Ave",
        "addressLine2": "Suite 2500",
        "city": "Chicago",
        "stateOrRegion": "IL",
        "postalCode": "60602",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    paymentIntent: "AuthorizeWithCapture",
};

const testPayClient = new Client.WebStoreClient(config);
const response = testPayClient.finalizeCheckoutSession('bd504926-f659-4ad7-a1a9-9a747aaf5275', payload);

response.then(function (result) {
    console.log(result.data);
}).catch(err => {
    console.log(err);
});
```

</div>
  </div>
</div>

</div>

#### Response

Returns <a href="https://restfulapi.net/http-status-200-ok" target="_blank" rel="noopener noreferrer">HTTP 200 status response code</a> if `paymentIntent` was successful. Returns <a href="https://restfulapi.net/http-status-202-accepted/" target="_blank" rel="noopener noreferrer">HTTP 202 status response code</a> if authorization is still pending.

```JSON
{
    "checkoutSessionId": "bd504926-f659-4ad7-a1a9-9a747aaf5275",
    "webCheckoutDetails": null,
    "chargePermissionType": "OneTime",   
    "recurringMetadata": null,
    "productType": null,
    "paymentDetails": null,
    "merchantMetadata": null,
    "supplementaryData":null, // Amazon Pay system data 
    "buyer": null,
    "billingAddress": null,
    "paymentPreferences": [
        null
    ],
    "statusDetails": {
        "state": "Completed",
        "reasonCode": null,
        "reasonDescription": null,
        "lastUpdatedTimestamp": "20191015T204327Z"
    },
    "shippingAddress": null,
    "platformId":null,
    "chargePermissionId": "S01-5105180-3221187",
    "chargeId": "S01-5105180-3221187-C056351",
    "constraints": [
        null
    ],
    "creationTimestamp": "20191015T204313Z",
    "expirationTimestamp": null,
    "storeId": null,
    "deliverySpecifications": null,
    "providerMetadata": null,
    "checkoutButtonText": null,
    "releaseEnvironment": null
}
```

#### Error codes

<table width="100%" border="1">
    <tbody>
        <tr id='RRV9CAAwEhs'>
            <td id='s:ERL9CA9q0ob;ERL9CADTh10' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>HTTP status code
                <br /></td>
            <td id='s:ERL9CA9q0ob;ERL9CAq22MQ' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Reason code
                <br /></td>
            <td id='s:ERL9CA9q0ob;ERL9CAFbHzY' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'><br>400 BAD_REQUEST
                <br /></td>
            <td id='' style='vertical-align: top;'><br>CurrencyMismatch
                <br /></td>
            <td id='' style='vertical-align: top;'>The currency code provided in the request does not match the currency set during checkout
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'><br>400 BAD_REQUEST
                <br /></td>
            <td id='' style='vertical-align: top;'><br>TransactionAmountExceeded
                <br /></td>
            <td id='' style='vertical-align: top;'>You've exceeded the maximum charge amount allowed for the Checkout Session
                <br /></td>
        </tr>
        <tr id='RRV9CApF183'>
            <td id='s:RRV9CApF183;RRV9CADEXUO' style='vertical-align: top;'><br>404 NOT_FOUND
                <br /></td>
            <td id='s:RRV9CApF183;RRV9CADSdxj' style='vertical-align: top;'><br>ResourceNotFound
                <br /></td>
            <td id='s:RRV9CApF183;RRV9CAxD9sC' style='vertical-align: top;'>Checkout Session details are permanently deleted after 30 days. Any request on the Checkout Session will return this error code
                <br /></td>
        </tr>
        <tr id='RRV9CAFTKSt'>
            <td id='s:RRV9CAFTKSt;RRV9CADEXUO' style=''>409 CONFLICT
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CADSdxj' style=''>ChargeAmountMismatch
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CAxD9sC' style=''>Mismatch between Checkout Session object <code>chargeAmount</code> and the request <code>chargeAmount</code>
                <br /></td>
        </tr>
         <tr id='RRV9CAFTKSt'>
            <td id='s:RRV9CAFTKSt;RRV9CADEXUO' style=''>409 CONFLICT
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CADSdxj' style=''>TotalOrderAmountMismatch
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CAxD9sC' style=''> Mismatch between Checkout Session object <code>totalOrderAmount</code> and the request <code>totalOrderAmount</code>
                <br /></td>
        </tr>
        <tr id='RRV9CAFTKSt'>
            <td id='s:RRV9CAFTKSt;RRV9CADEXUO' style=''>409 CONFLICT
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CADSdxj' style=''>CanHandlePendingAuthorizationMismatch
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CAxD9sC' style=''> Mismatch between Checkout Session object <code>canHandlePendingAuthorization</code> and the request <code>canHandlePendingAuthorization</code>
                <br /></td>
        </tr>
        <tr id='RRV9CAFTKSt'>
            <td id='s:RRV9CAFTKSt;RRV9CADEXUO' style=''>409 CONFLICT
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CADSdxj' style=''>PaymentIntentMismatch
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CAxD9sC' style=''> Mismatch between Checkout Session object <code>paymentIntent</code> and the request <code>paymentIntent</code>
                <br /></td>
        </tr>
        <tr id='RRV9CAFTKSt'>
            <td id='s:RRV9CAFTKSt;RRV9CADEXUO' style=''>409 CONFLICT
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CADSdxj' style=''>ShippingAddressMismatch
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CAxD9sC' style=''> Mismatch between Checkout Session object and the request on: <code>shippingAddress</code>
                <br /></td>
        </tr>
        <tr id='RRV9CAFTKSt'>
            <td id='s:RRV9CAFTKSt;RRV9CADEXUO' style=''>409 CONFLICT
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CADSdxj' style=''>BillingAddressMismatch
                <br /></td>
            <td id='s:RRV9CAFTKSt;RRV9CAxD9sC' style=''> Mismatch between Checkout Session object and the request on: <code>billingAddress</code>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'><br>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='' style='vertical-align: top;'><br>CheckoutSessionCanceled
                <br /></td>
            <td id='' style='vertical-align: top;'>Checkout was unsuccessful because the buyer cancelled the transaction or payment was declined
                <br /></td>
        </tr>
        <tr id='RRV9CApBW84'>
            <td id='s:RRV9CApBW84;RRV9CADEXUO' style='vertical-align: top;'><br>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CApBW84;RRV9CADSdxj' style='vertical-align: top;'>InvalidCheckoutSessionStatus
                <br /></td>
            <td id='s:RRV9CApBW84;RRV9CAxD9sC' style='vertical-align: top;'>You tried to call an operation on a Checkout Session that is in a state where that operation is not allowed
                <br /></td>
        </tr>
        <tr id='RRV9CApBW84'>
            <td id='s:RRV9CApBW84;RRV9CADEXUO' style='vertical-align: top;'><br>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CApBW84;RRV9CADSdxj' style='vertical-align: top;'>InvalidChargeStatus
                <br /></td>
            <td id='s:RRV9CApBW84;RRV9CAxD9sC' style='vertical-align: top;'>You tried to call an operation on a Charge that is in a state where that operation is not allowed or you tried to Complete Checkout Session on a Checkout Session with <code>paymentIntent</code> set to AuthorizeWithCapture and <code>canHandlePendingAuthorization</code> set to true
                <br /></td>
        </tr>
        <tr id='RRV9CARZv8O'>
            <td id='s:RRV9CARZv8O;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CARZv8O;RRV9CADSdxj' style='vertical-align: top;'>HardDeclined
                <br /></td>
            <td id='s:RRV9CARZv8O;RRV9CAxD9sC' style='vertical-align: top;'>Charge was hard declined. Retry attemps will not succeed. Please contact the buyer and have them choose a different payment instrument
                <br /></td>
        </tr>
        <tr id='RRV9CADgbCA'>
            <td id='s:RRV9CADgbCA;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CADgbCA;RRV9CADSdxj' style='vertical-align: top;'>PaymentMethodNotAllowed
                <br /></td>
            <td id='s:RRV9CADgbCA;RRV9CAxD9sC' style='vertical-align: top;'>The payment method selected by the buyer is not allowed for this charge
                <br /></td>
        </tr>
        <tr id='RRV9CAUzZgT'>
            <td id='s:RRV9CAUzZgT;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CAUzZgT;RRV9CADSdxj' style='vertical-align: top;'>AmazonRejected
                <br /></td>
            <td id='s:RRV9CAUzZgT;RRV9CAxD9sC' style='vertical-align: top;'>Charge was declined by Amazon. The associated Charge Permission will also be canceled
                <br /></td>
        </tr>
        <tr id='RRV9CAY9tT2'>
            <td id='s:RRV9CAY9tT2;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CAY9tT2;RRV9CADSdxj' style='vertical-align: top;'>MFANotCompleted
                <br /></td>
            <td id='s:RRV9CAY9tT2;RRV9CAxD9sC' style='vertical-align: top;'>Multi-factor authentication (MFA) is required to be complete by the buyer for this transaction to process
                <br /></td>
        </tr>
        <tr id='RRV9CAm8slJ'>
            <td id='s:RRV9CAm8slJ;RRV9CADEXUO' style='vertical-align: top;'>422 UNPROCESSABLE_ENTITY
                <br /></td>
            <td id='s:RRV9CAm8slJ;RRV9CADSdxj' style='vertical-align: top;'>TransactionTimedOut
                <br /></td>
            <td id='s:RRV9CAm8slJ;RRV9CAxD9sC' style='vertical-align: top;'>If you set <code>canHandlePendingAuthorization</code> to false, the Charge was declined because Amazon Pay did not have enough time to process the authorization. Contact the buyer and have them choose another payment method. If you frequently encounter this decline, consider setting <code>canHandlePendingAuthorization</code> to true<br><br>If you set <code>canHandlePendingAuthorization</code> to true, the Charge was declined because Amazon Pay was unable to determine the validity of the order. Contact the buyer and have them choose another payment method. See <a href="https://pay.amazon.com">asynchronous processing </a>for more information
                <br /></td>
        </tr>
        <tr id='RRV9CA59kyj'>
            <td id='s:RRV9CA59kyj;RRV9CADEXUO' style='vertical-align: top;'>500 INTERNAL_SERVER_ERROR
                <br /></td>
            <td id='s:RRV9CA59kyj;RRV9CADSdxj' style='vertical-align: top;'>ProcessingFailure
                <br /></td>
            <td id='s:RRV9CA59kyj;RRV9CAxD9sC' style='vertical-align: top;'>Amazon could not process the Charge because of an internal processing error. You should retry the charge only if the Charge Permission is in the Chargeable state
                <br /></td>
        </tr>
    </tbody>
</table>

Generic errors can be found <a href="../amazon-pay-api-v2/error-handling.md" target="_blank" rel="noopener noreferrer">here</a>.

### Related topics

* [Charge permission object](../amazon-pay-api-v2/charge-permission.html)
* [Charge object](../amazon-pay-api-v2/charge.html)
