---
title: Verify & complete checkout
url: amazon-pay-buy-now-checkout/verify-and-complete-checkout.html
---

**[Step 4 of 8]** When the `onCompleteCheckout` event handler is invoked, utilize the `Finalize Checkout Session` API, which enables Amazon Pay to validate payment critical attributes. This API replaces the `Complete Checkout Session` API of the standard Amazon Pay [CV2](https://developer.amazon.com/de/docs/amazon-pay-recurring-checkout/verify-and-complete-checkout.html)integration flow. As the API validates critical information, only consider the checkout successful, if you get a successful response from this API. 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" /}

---

### Finalize Checkout Session

Use [Finalize Checkout Session](../amazon-pay-api-v2/checkout-session.html#finalize-checkout-session) to confirm you have successfully received the `onCompleteCheckout` event.
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`.

<div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> Amazon Pay will not finalize the `paymentIntent` until you confirm checkout with Finalize Checkout Session. Any Checkout Session that is not confirmed within 24 hours will be cancelled. If payment authorization was requested it will also be cancelled.</div>

**Successful response:**

[Finalize Checkout Session](../amazon-pay-api-v2/checkout-session.html#finalize-checkout-session) will return a success response if the transaction was processed successfully. Implement the guidance that corresponds to the Checkout Session `paymentIntent`:

<table width="100%" border="1"> 
    <tbody>
        <tr id='SNR9CAGnO6p'>
            <td id='s:SNR9CAGnO6p;SNR9CAhxnzV' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>paymentIntent
                <br /></td>
            <td id='s:SNR9CAGnO6p;SNR9CA8ReW0' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='SNR9CAHofkb'>
            <td id='s:SNR9CAHofkb;SNR9CAhxnzV' style=''>AuthorizeWithCapture
                <br /></td>
            <td id='s:SNR9CAHofkb;SNR9CA8ReW0' style=''>Payment has been authorized and captured. <br><br>1. Store the <code>ChargeId</code> - You must store the <code>ChargeId</code> to process refunds.<br><br> 2. Store the <code>ChargePermissionId</code> - If you specified <code>totalOrderAmount</code> and there is uncaptured payment, see <a href="../amazon-pay-checkout/deferred-transactions.md" target="_blank" rel="noopener noreferrer">manage deferred payments</a> for more information. You can also use the <code>ChargePermissionId</code> to retrieve buyer and transaction info using <a href="../amazon-pay-api-v2/charge-permission.md#get-charge-permission" target="_blank" rel="noopener noreferrer">Get Charge Permission</a> for 30 days, you must store the data to persist the information beyond 30 days. 
                <br /></td>
        </tr>
        <tr id='SNR9CAGci5Y'>
            <td id='s:SNR9CAGci5Y;SNR9CAhxnzV' style=''>Authorize
                <br /></td>
            <td id='s:SNR9CAGci5Y;SNR9CA8ReW0' style=''>Payment has been authorized. <br><br>1. Store the <code>ChargeId</code> - You must store the ChargeID for deferred payment capture. See <a href="../amazon-pay-checkout/deferred-transactions.md" target="_blank" rel="noopener noreferrer">deferred transactions</a> for more info.<br><br> 2. Store the <code>ChargePermissionId</code> - If you specified <code>totalOrderAmount</code> and there is uncaptured payment, see <a href="../amazon-pay-checkout/deferred-transactions.md" target="_blank" rel="noopener noreferrer">manage deferred payments</a> for more information. You can also use the <code>ChargePermissionId</code> to retrieve buyer and transaction info using <a href="../amazon-pay-api-v2/charge-permission.md#get-charge-permission" target="_blank" rel="noopener noreferrer">Get Charge Permission</a> for 30 days, you must store the data to persist the information beyond 30 days. 
                <br /></td>
        </tr>
        <tr id='SNR9CA2df1n'>
            <td id='s:SNR9CA2df1n;SNR9CAhxnzV' style=''>Confirm
                <br /></td>
            <td id='s:SNR9CA2df1n;SNR9CA8ReW0' style=''>Payment has not been authorized or captured.<br><br>1. Store the <code>ChargePermissionId</code> - You must store the <code>ChargePermissionId</code> for deferred payment authorization. See <a href="../amazon-pay-checkout/deferred-transactions.md" target="_blank" rel="noopener noreferrer">deferred transactions</a> for more info. You can also use the <code>ChargePermissionId</code> to retrieve buyer and transaction info after checkout. You will only be able to retrieve the data using <a href="../amazon-pay-api-v2/charge-permission.md#get-charge-permission" target="_blank" rel="noopener noreferrer">Get Charge Permission</a> for 30 days, you must store the data to persist the information beyond 30 days.  
                <br /></td>
        </tr>
    </tbody>
</table>

**Error response:**

[Finalize Checkout Session](../amazon-pay-api-v2/checkout-session.html#finalize-checkout-session) 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 payment was not successful. Please try another payment method.“
