---
title: "Prepare an unpaid checkout from an offer"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.nicer.travel/llms.txt
> Use this file to discover all available pages before exploring further.

# Prepare an unpaid checkout from an offer

Path: Nicer API › Commerce

`POST /commerce/checkouts`

URL: `https://api.nicer.travel/commerce/checkouts`

Turns a live search offer into an unpaid order: it re-validates the offer with the provider, prices it, and creates the order on the trip; `paymentUrl` is null, and `createPaymentLink` makes the link. Nothing is paid, held or reserved. Calling it twice for the same offer on the same trip returns the same order rather than a second one — the key is the offer and the trip, so no caller has to invent one. `status` is `OK` with the order, `PRICE_CHANGED` when the provider now charges something else (search again and use the new offer), or `UNAVAILABLE` when the offer is gone.

## Authentication

- `bearerAuth`, http bearer, header `Authorization`, format `JWT`

## Header parameters

- `x-nicer-company` (`commerce.checkouts.create.header.x-nicer-company`; string, required) — Company context. Authentication and tenant membership are validated by the API.

## Request body

_Required._

- `offerReference` (`commerce.checkouts.create.offerReference`; string, required) — The offer to buy, from a hotel, flight or car search.
  - minLength: `1`
- `travelersTripId` (`commerce.checkouts.create.travelersTripId`; string, required) — The trip the order belongs to.
  - minLength: `1`

## Example request

```json
{
  "offerReference": "string",
  "travelersTripId": "string"
}
```

## Code samples

### JavaScript SDK

```javascript
import { createClient } from "@nicertravel/sdk";

const nicer = createClient({
  baseUrl: "https://api.nicer.travel",
  token: process.env.NICER_TOKEN,
  headers: { "x-nicer-company": process.env.NICER_COMPANY },
});

await nicer.commerce.checkouts.create({
  "offerReference": "string",
  "travelersTripId": "string"
});
```

### Nicer CLI

```bash
nicer commerce checkouts create --company "$NICER_COMPANY" --input - <<'JSON'
{
  "offerReference": "string",
  "travelersTripId": "string"
}
JSON
```

### cURL

```bash
curl --request POST \
  --url https://api.nicer.travel/commerce/checkouts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-nicer-company: string' \
  --data '
{
  "offerReference": "string",
  "travelersTripId": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/commerce/checkouts';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-nicer-company': 'string',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({offerReference: 'string', travelersTripId: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.nicer.travel/commerce/checkouts"

payload = {
    "offerReference": "string",
    "travelersTripId": "string"
}
headers = {
    "Content-Type": "application/json",
    "x-nicer-company": "string",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "status": "OK",
  "checkout": {
    "currency": "string",
    "expiresAt": "2019-08-24T14:15:22Z",
    "orderId": "string",
    "paymentUrl": "string",
    "title": "string",
    "totalMinor": 9007199254740991
  },
  "reason": "string"
}
```

- `status` (`commerce.checkouts.create.response.200.status`; string, required)
  - one of `"OK"`, `"PRICE_CHANGED"`, `"UNAVAILABLE"`
- `checkout` (`commerce.checkouts.create.response.200.checkout`; any of, required)
  - any of the following:
    - `object`
      - `currency` (`commerce.checkouts.create.response.200.checkout.1.currency`; string, required)
        - pattern: `^[A-Z]{3}$`
      - `expiresAt` (`commerce.checkouts.create.response.200.checkout.1.expiresAt`; string, required)
        - format: `date-time` · pattern: `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$`
      - `orderId` (`commerce.checkouts.create.response.200.checkout.1.orderId`; string, required)
        - minLength: `1`
      - `paymentUrl` (`commerce.checkouts.create.response.200.checkout.1.paymentUrl`; any of, required)
        - any of the following: `string`, `null`
      - `title` (`commerce.checkouts.create.response.200.checkout.1.title`; string, required)
        - maxLength: `512` · minLength: `1`
      - `totalMinor` (`commerce.checkouts.create.response.200.checkout.1.totalMinor`; integer, required)
        - maximum: `9007199254740991` · minimum: `0`
    - `null`
- `reason` (`commerce.checkouts.create.response.200.reason`; any of, required)
  - any of the following: `string`, `null`

### 400

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`commerce.checkouts.create.response.400.errorCode`; string, required)
- `errorMessage` (`commerce.checkouts.create.response.400.errorMessage`; string, required)

### 401

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`commerce.checkouts.create.response.401.errorCode`; string, required)
- `errorMessage` (`commerce.checkouts.create.response.401.errorMessage`; string, required)

### 403

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`commerce.checkouts.create.response.403.errorCode`; string, required)
- `errorMessage` (`commerce.checkouts.create.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/Commerce/commerce.checkouts.create/index.md
