> ## Documentation Index
> Fetch the complete documentation index at: https://developers.artport.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Finalize Checkout Session

### Overview

This endpoint can be used to finalize a checkout session and pay for the shipments.

Endpoint: `/api/v1/checkout`

Method: `POST`

<Note>
  A maximum of 10 shipments can be included in a single checkout session.
</Note>

<Note>
  You must first use the `GET` endpoint so that the price may be calculated for each shipment. If you attempt to finalize a shipment that does not have a price, then you will receive an error.
</Note>

<Warning>
  This endpoint will charge the total price of each shipment in the checkout session to the organization's payment method.

  Please ensure that each shipment's details are correct, and that all [addresses have been verified](/guide/api/addresses/verify) before finalising the checkout session.

  Failure to do so may result in delays, lost shipments, or extra charges.
</Warning>

<Warning>
  Your organization requires a stored payment method in order to process a checkout session.
</Warning>

### Request

<ResponseField name="shipments" type="array" required>
  An array of up to `10` shipment IDs to be included in the finalized checkout session.

  <Expandable title="shipments" defaultOpen="true">
    <ResponseField name="id" type="integer" required>
      The ID of the shipment to finalize in the checkout session.
    </ResponseField>
  </Expandable>
</ResponseField>

### Response (204)

If the checkout session is successfully stored, the API will return a `204 No Content` status code.

The response will not contain any content.

### Response (403)

If the organization does not have a valid payment method to charge, then the API will return a `403 Forbidden` status code.

### Response (402)

If the checkout session was not successfully stored because the payment provider declined the organization's card, then the API will return a `402 Payment Required` status code.

<Note>
  Receiving this response will automatically invalidate your payment method. You will need to address this via the ArtPort website before you can make further payment attempts.
</Note>

The response will contain the following content:

<ResponseField name="status" type="integer" required>
  The internal status code of the error.
</ResponseField>

<ResponseField name="message" type="string" required>
  A human-readable message explaining the error.
</ResponseField>

### Response (409)

If the checkout session was not successfully created because payment failed, then the API will return a `409 Conflict` status code.

<Note>
  In most cases, this is a temporary error and you can simply retry the request. It is recommended that you wait a minute or so before retrying. This increases the chance that your request will be processed successfully.
</Note>

The response will contain the following content:

<ResponseField name="status" type="integer" required>
  The internal status code of the error.
</ResponseField>

<ResponseField name="message" type="string" required>
  A human-readable message explaining the error.
</ResponseField>

<RequestExample>
  ```json Example Request Body Structure theme={"system"}
  {
      "shipments": [
          125,
          126,
          127
      ]
  }
  ```
</RequestExample>

<ResponseExample>
  ```text 204 theme={"system"}
  No Content
  ```

  ```json 403 theme={"system"}
  "You are not able to do this"
  ```

  ```json 402 theme={"system"}
  {
      "status": 0,
      "message": "Your card was declined... check your wallet"
  }
  ```

  ```json 409 theme={"system"}
  {
      "status": 1,
      "message": "Something went wrong... please try again"
  }
  ```
</ResponseExample>
