---
title: Verify & complete checkout
url: amazon-pay-paymentmethodonfile-setupintent/verify-and-complete-checkout.html
---

**[Step 3 of 8]** The buyer is redirected to `checkoutResultReturnUrl` after Amazon Pay has processed the transaction or setup. The Amazon Pay checkout session ID will be included as a query parameter. 

In this step, you will use the checkout session ID to confirm that the buyer has successfully returned to your site. At the end of this step, you will be able to present the buyer with the checkout result.

<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>


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

***

### 1. Complete Checkout Session  

Use <a href="../amazon-pay-paymentmethodonfile/checkout-session.md#complete-checkout-session" target="_blank" rel="noopener noreferrer">Complete Checkout Session</a> to confirm that the buyer has successfully returned to your site. 

**Note:** 
1. `chargeAmount` is not required for Saved Wallet setup intent flow.
2. Amazon Pay will not finalize the Saved Wallet setup until you confirm checkout with Complete Checkout Session. Any Checkout Session that is not confirmed within 24 hours will be cancelled. 

**Successful response:**

<a href="../amazon-pay-paymentmethodonfile/checkout-session.md#complete-checkout-session" target="_blank" rel="noopener noreferrer">Complete Checkout Session</a> will return a success response if the setup was processed successfully. 

**Error response:**

<a href="../amazon-pay-paymentmethodonfile/checkout-session.md#complete-checkout-session" target="_blank" rel="noopener noreferrer">Complete Checkout Session</a> will return an error response for failed transactions. The buyer either canceled checkout or was unable to provide a valid payment instrument. You should:

1. Redirect the buyer to the start of checkout
2. Display a message such as: "Your request to save Amazon Pay as a payment method was not successful. Please try again.“

#### 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

```
{ }
```



#### Request parameters

<table width="100%" border="1">
    <tbody>
        <tr id='KXD9CAJ88iF'>
            <td id='s:KXD9CAJ88iF;KXD9CADiVeR' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Name
                <br /></td>
            <td id='s:KXD9CAJ88iF;KXD9CA9GoG8' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Location
                <br /></td>
            <td id='s:KXD9CAJ88iF;KXD9CAdm9hl' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='SNR9CAdeMYQ'>
            <td id='s:SNR9CAdeMYQ;SNR9CAbxfBm' style='vertical-align: top;'>checkoutSessionId<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:SNR9CAdeMYQ;SNR9CAaOGKM' style='vertical-align: top;'>Path parameter
                <br /></td>
            <td id='s:SNR9CAdeMYQ;SNR9CASSshX' style='vertical-align: top;'>Checkout Session identifier
                <br /></td>
        </tr>        
    </tbody>
</table>

#### Response

Returns [HTTP 200 status response code](https://restfulapi.net/http-status-200-ok) if setup was successful

```
{
    "checkoutSessionId": "bd504926-f659-4ad7-a1a9-9a747aaf5275",
    "webCheckoutDetails": null,
    "chargePermissionType": PaymentMethodOnFile,   
    "recurringMetadata": null,
    "productType": null,
    "paymentDetails": null,
    "merchantMetadata": null,
    "paymentMethodOnFileMetadata": 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,
    "releaseEnvironment": null
}
```

