> For the complete documentation index, see [llms.txt](https://docs.whisk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.whisk.com/master/api/carts/checkout.md).

# Checkout

You can perform Store Transfer operations by submitting a list of SKU with corresponding amounts. Alternatively, you can also provide a list of raw items for retailers like AmazonFresh and Instacart.

## Checkout Flow

Retailers provide different ways to the authenticated user and match products in-store. Currently we support 3 different flows.

It can affect your user experience. Please check details for each flow in [retailers sections](/master/api/retailers/retailers-checkout-flow.md)

## Affiliates

Whisk supports several affiliate networks. You can pass your affiliate codes through checkout API.

Supported affiliate services at the moment: `Awin`, `VigLink`, `CJ Affiliate`.

Stores which support affiliates:

* Instacart
* AmazonFresh
* BritishCornerShop
* Billa
* Tesco
* Ocado
* Waitrose
* Walmart
* Woolworths

Use field extra to pass your affiliate codes.

## Checkout

<mark style="color:green;">`POST`</mark> `https://graph.whisk.com/v1/carts/checkout`

#### Request Body

| Name        | Type   | Description                                                                          |
| ----------- | ------ | ------------------------------------------------------------------------------------ |
| retailerId  | string | Retailer Id to perform Checkout for. (short names can be used)                       |
| credentials | object | Authentication credentials in store. Might be Basic or OAuth                         |
| items       | array  | An array of CheckoutItem objects holding items to checkout                           |
| extra       | object | A CheckoutExtra object holding extra properties that may be specific to the retailer |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

### CheckoutItem

| ATTRIBUTE | TYPE                   | DESCRIPTION |
| --------- | ---------------------- | ----------- |
| storeItem | StoreItemCheckoutValue |             |
| raw       | RawItemCheckoutValue   |             |

### CheckoutExtra

| ATTRIBUTE | TYPE          | DESCRIPTION           |
| --------- | ------------- | --------------------- |
| affiliate | AffiliateInfo | Affiliate information |

### AffiliateInfo

| ATTRIBUTE | TYPE   | DESCRIPTION       |
| --------- | ------ | ----------------- |
| awin      | string | Awin code         |
| cj        | string | CJ Affiliate code |
| vigLink   | string | VigLink code      |

### StoreItemCheckoutValue

| ATTRIBUTE | TYPE    | DESCRIPTION                                  |
| --------- | ------- | -------------------------------------------- |
| sku\*     | string  | item identifier in Retailer                  |
| quantity  | integer | Number of items to checkout Default value: 1 |

### RawItemCheckoutValue

| ATTRIBUTE | TYPE   | DESCRIPTION                          |
| --------- | ------ | ------------------------------------ |
| name\*    | string | Raw item text. Example: 1 tbsp sugar |

### Credentials

| ATTRIBUTE | TYPE             | DESCRIPTION                            |
| --------- | ---------------- | -------------------------------------- |
| basic     | BasicCredentials | Basic credentials, login, and password |
| oauth     | OAuthCredentials | Basic credentials, login, and password |

### BasicCredentials

| ATTRIBUTE  | TYPE   | DESCRIPTION |
| ---------- | ------ | ----------- |
| username\* | string |             |
| password\* | string |             |

### OAuthCredentials

| ATTRIBUTE | TYPE   | DESCRIPTION |
| --------- | ------ | ----------- |
| token\*   | string | OAuth token |

## CheckoutResponse

| ATTRIBUTE           | TYPE                    | DESCRIPTION                                                                                                                                                          |
| ------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| status\*            | enum                    | status indicates the state of checkout and provides info on the following action users need to take. Possible values: CompleteCheckoutUrlProvided, ItemsTransferred. |
| items               | array \[CheckedOutItem] | list of items added to basket (if applicable)                                                                                                                        |
| completeCheckoutUrl | string                  | URL to complete checkout (if applicable)                                                                                                                             |

### CheckedOutItem

| ATTRIBUTE | TYPE          | DESCRIPTION                                                                                                                                        |
| --------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| sku\*     | string        | item identifier in a store                                                                                                                         |
| status\*  | enum          | status indicates whether an item was added to retailers cart or not Possible values: CheckedOut, Failed, OutOfStock, ReachedMaxItems, Unavailable. |
| item      | InventoryItem | item details                                                                                                                                       |

### InventoryItem

| ATTRIBUTE  | TYPE                     | DESCRIPTION              |
| ---------- | ------------------------ | ------------------------ |
| sku\*      | string                   | item identifier in store |
| name\*     | string                   | item name                |
| quantity\* | object                   | count of items           |
| url\*      | string                   | direct item URL          |
| price\*    | Price                    | item price               |
| images\*   | array \[ResponsiveImage] | responsive images        |

### Price

| ATTRIBUTE | TYPE   | DESCRIPTION |
| --------- | ------ | ----------- |
| list      | number | Total price |

### Sample Request

```bash
curl -X POST "https://graph.whisk.com/v1/carts/checkout" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Token <Access-Token>" \
  -d '{
    "items": [
      {
        "storeItem": {
          "sku": "278272994",
          "quantity": 1
        }
      },
      {
        "storeItem": {
          "sku": "258270595"
        }
      }
    ],
    "retailerId": "tesco",
    "credentials": {
      "basic": {
        "username": "email@example.com",
        "password": "s3cret"
      }
    }
  }'
```

### Example with AmazonFresh

```bash
curl -X POST "https://graph.whisk.com/v1/carts/checkout" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Token <Access-Token>" \
  -d '{
    "items": [
      {
        "raw": {
          "name": "4 large eggs"
        }
      },
      {
        "raw": {
          "name": "handful basil leaves"
        }
      }
    ],
    "retailerId": "amazonfresh-us"
  }'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.whisk.com/master/api/carts/checkout.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
