---
title: "Submit checkout or create a payment link"
---

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

# Submit checkout or create a payment link

Path: Nicer API › Commerce

`POST /commerce/orders/{orderId}/actions`

URL: `https://api.nicer.travel/commerce/orders/{orderId}/actions`

Runs an authenticated order action. Requires a verified user session, access to the order and an Idempotency-Key. Payment links cannot create links or cancel reservations. Access covers the agency's admins, its advisors on orders they take part in, Nicer staff, and the order's travelers (payer, participants and the trip's people). Travelers may submit checkout, make links, renew, cancel an unpaid order and release a hold; cancelling a booked reservation is refused to them with 403 ERROR_DO_NOT_HAVE_PERMISSION, because it is cancelled with the supplier and refunded. A link meant for another person is made with audience TRAVELER: a SELF link signs whoever opens it in the first minute into the pay page as its creator. RENEW_CHECKOUT reprices an unpaid checkout past its window into a successor order and returns its payment link.

## Authentication

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

## Path parameters

- `orderId` (`commerce.orders.actions.create.path.orderId`; string, required)

## Header parameters

- `Idempotency-Key` (`commerce.orders.actions.create.header.Idempotency-Key`; string, required) — Unique key (8–255 chars) per request; replays return the original result.

## Request body

_Required._

Every option has:

- `type` (`<option>.type`; string, required)

One of the following, each adding:

- `object` (`commerce.orders.actions.create.1`)
  - `code` (`commerce.orders.actions.create.1.code`; string, required)
    - pattern: `^[A-Za-z0-9_-]{43}$`
- `object` (`commerce.orders.actions.create.2`)
- `object` (`commerce.orders.actions.create.3`)
  - `acceptedTermsDigest` (`commerce.orders.actions.create.3.acceptedTermsDigest`; string, required)
    - pattern: `^sha256:[a-f0-9]{64}$`
  - `participants` (`commerce.orders.actions.create.3.participants`; array of object, required)
    - `address` (`commerce.orders.actions.create.3.participants.address`; any of, required) — The person's postal address; null when unknown.
      - any of the following: `PersonAddress`, `null`
    - `birthDate` (`commerce.orders.actions.create.3.participants.birthDate`; any of, required) — The person's date of birth, YYYY-MM-DD; null when unknown.
      - any of the following: `string`, `null`
    - `contact` (`commerce.orders.actions.create.3.participants.contact`; object, required) — How to reach the person.
      - `email` (`commerce.orders.actions.create.3.participants.contact.email`; any of, required)
        - any of the following: `string`, `null`
      - `phone` (`commerce.orders.actions.create.3.participants.contact.phone`; any of, required)
        - any of the following: `E164Phone`, `null`
    - `documents` (`commerce.orders.actions.create.3.participants.documents`; array of object, required) — The person's travel documents (passport, visa, national ID), up to 12; empty when there are none.
      - `expirationDate` (`commerce.orders.actions.create.3.participants.documents.expirationDate`; any of, required) — The day the document expires, YYYY-MM-DD; null for one that does not.
        - any of the following: `string`, `null`
      - `issuingCountryCode` (`commerce.orders.actions.create.3.participants.documents.issuingCountryCode`; any of, required) — The country that issued the document, as an ISO 3166-1 alpha-2 country code; null when unknown.
        - any of the following: `CountryCode`, `null`
      - `kind` (`commerce.orders.actions.create.3.participants.documents.kind`; string, required) — What the document is.
        - one of `"DRIVER_LICENSE"`, `"KNOWN_TRAVELER_NUMBER"`, `"NATIONAL_ID"`, `"PASSPORT"`, `"REDRESS_NUMBER"`, `"RESIDENCE_PERMIT"`, `"VISA"`
      - `number` (`commerce.orders.actions.create.3.participants.documents.number`; string, required) — The document's number, in full, 1 to 100 characters.
        - maxLength: `100` · minLength: `1`
      - `citizenshipCountry` (`commerce.orders.actions.create.3.participants.documents.citizenshipCountry`; any of, optional) — The citizenship stated on this document, as an ISO 3166-1 alpha-2 country code; it is not always the person's nationality. Null or absent when the document states none.
        - any of the following: `CountryCode`, `null`
      - `issueDate` (`commerce.orders.actions.create.3.participants.documents.issueDate`; any of, optional) — The day the document was issued, YYYY-MM-DD; null or absent when unknown.
        - any of the following: `string`, `null`
      - `placeOfBirth` (`commerce.orders.actions.create.3.participants.documents.placeOfBirth`; any of, optional) — The place of birth printed on the document; null or absent when unknown.
        - any of the following: `string`, `null`
      - `placeOfIssue` (`commerce.orders.actions.create.3.participants.documents.placeOfIssue`; any of, optional) — Where the document was issued; null or absent when unknown.
        - any of the following: `string`, `null`
    - `name` (`commerce.orders.actions.create.3.participants.name`; object, required) — The person's legal name, as printed on their travel document.
      - `familyName` (`commerce.orders.actions.create.3.participants.name.familyName`; string, required)
        - maxLength: `100` · minLength: `1`
      - `givenName` (`commerce.orders.actions.create.3.participants.name.givenName`; string, required)
        - maxLength: `100` · minLength: `1`
      - `middleName` (`commerce.orders.actions.create.3.participants.name.middleName`; any of, required)
        - any of the following: `string`, `null`
    - `nationalityCountryCode` (`commerce.orders.actions.create.3.participants.nationalityCountryCode`; any of, required) — The person's nationality, as an ISO 3166-1 alpha-2 country code; null when unknown.
      - any of the following: `CountryCode`, `null`
    - `participantId` (`commerce.orders.actions.create.3.participants.participantId`; string, required) — An id you make up for this participant, such as P1, unique among the participants of the order.
      - minLength: `1`
    - `sex` (`commerce.orders.actions.create.3.participants.sex`; any of, required) — The sex marker printed on the person's travel document; null when unknown.
      - any of the following: `ParticipantSex`, `null`
    - `hotelMembership` (`commerce.orders.actions.create.3.participants.hotelMembership`; any of, optional) — The person's membership number with the hotel chain (chainCode), for a hotel booking; null or left out when there is none.
      - any of the following: `HotelMembership`, `null`
    - `frequentFlyerPrograms` (`commerce.orders.actions.create.3.participants.frequentFlyerPrograms`; array of object, optional) — The person's airline loyalty memberships, up to 8, sent with a flight booking.
      - `airlineIataCode` (`commerce.orders.actions.create.3.participants.frequentFlyerPrograms.airlineIataCode`; string, required)
        - pattern: `^[A-Z0-9]{2,3}$`
      - `memberNumber` (`commerce.orders.actions.create.3.participants.frequentFlyerPrograms.memberNumber`; string, required)
        - maxLength: `100` · minLength: `1`
    - `travelerId` (`commerce.orders.actions.create.3.participants.travelerId`; string, optional) — The CRM traveler this participant was filled from, as GET /crm/trips/{travelersTripId} answers it. Leave it out when the details were typed in.
      - minLength: `1`
  - `airPlanningFeeMinor` (`commerce.orders.actions.create.3.airPlanningFeeMinor`; integer, optional) — Air planning fee in USD cents for the whole reservation.
    - maximum: `100000000`
  - `paymentTermsKind` (`commerce.orders.actions.create.3.paymentTermsKind`; string, optional) — HOLD requires a confirmed airline deadline at least 12 hours away and gives the customer half the remaining window to pay. PAY_NOW books with the card sent next. Omitted means HOLD where allowed. An unsupported hold answers 409 COMMERCE_HOLD_NOT_ALLOWED; a window that no longer qualifies answers 409 COMMERCE_HOLD_WINDOW_UNAVAILABLE.
    - one of `"HOLD"`, `"PAY_NOW"`
  - `specialRequest` (`commerce.orders.actions.create.3.specialRequest`; any of, optional)
    - default: `null`
    - any of the following: `string`, `null`
  - `notifyTravelers` (`commerce.orders.actions.create.3.notifyTravelers`; boolean, optional) — False sends this order's emails (its booking confirmation and its hold, declined-payment, ticketing and cancellation notices) to its advisor alone, never to its travelers or payer. The payer still gets the receipt of a card payment, and sendOrderConfirmation still reaches the addresses it names. Omitted means true.
  - `validatingCarrier` (`commerce.orders.actions.create.3.validatingCarrier`; string, optional) — The airline that issues a flight's ticket, one of productSnapshot.validatingCarriers. The default (the first) or an absent choice leaves issuance to the provider. The choice is the agency's: only an advisor or staff caller, or the agency's own payment link, may send a code; a traveler or a traveler link answers 403 COMMERCE_VALIDATING_CARRIER_ADVISOR_ONLY, and a code the fare does not offer answers 409 COMMERCE_VALIDATING_CARRIER_NOT_OFFERED.
    - pattern: `^[A-Z0-9]{2,3}$`
- `object` (`commerce.orders.actions.create.4`)
  - `audience` (`commerce.orders.actions.create.4.audience`; string, optional)
    - one of `"SELF"`, `"TRAVELER"` · default: `"TRAVELER"`
  - `expiresInMinutes` (`commerce.orders.actions.create.4.expiresInMinutes`; integer, optional) — Can only shorten the link, never lengthen it. A booking's link ends at most 15 minutes from now and, for an order not yet held, 10 minutes after the order was created, because its price holds only that long; past it, the same link still opens for 24 hours and the traveler renews the checkout there at the current price. A planning fee's or an extra payment's link holds no price and lasts until its order expires, 30 days after it was created. The answer's expiresAt says when.
    - maximum: `43200` · minimum: `15` · default: `43200`
- `object` (`commerce.orders.actions.create.5`)
  - `paymentAttemptId` (`commerce.orders.actions.create.5.paymentAttemptId`; string, required)
    - minLength: `1`
- `object` (`commerce.orders.actions.create.6`)
  - `acceptedTermsDigest` (`commerce.orders.actions.create.6.acceptedTermsDigest`; string, required)
    - pattern: `^sha256:[a-f0-9]{64}$`
  - `reason` (`commerce.orders.actions.create.6.reason`; any of, optional)
    - default: `null`
    - any of the following: `string`, `null`
- `object` (`commerce.orders.actions.create.7`)
  - `capabilityId` (`commerce.orders.actions.create.7.capabilityId`; string, required)
    - minLength: `1`

## Example request

```json
{
  "type": "EXCHANGE_CHECKOUT_SESSION",
  "code": "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: { "Idempotency-Key": process.env.NICER_IDEMPOTENCY_KEY },
});

await nicer.commerce.orders.actions.create({
  "orderId": "string",
  "type": "EXCHANGE_CHECKOUT_SESSION",
  "code": "string"
});
```

### Nicer CLI

```bash
nicer commerce orders actions create --order-id 'string' --input - <<'JSON'
{
  "type": "EXCHANGE_CHECKOUT_SESSION",
  "code": "string"
}
JSON
```

### cURL

```bash
curl --request POST \
  --url 'https://api.nicer.travel/commerce/orders/<orderId>/actions' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: string' \
  --data '
{
  "type": "EXCHANGE_CHECKOUT_SESSION",
  "code": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/commerce/orders/<orderId>/actions';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Idempotency-Key': 'string',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({type: 'EXCHANGE_CHECKOUT_SESSION', code: '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/orders/<orderId>/actions"

payload = {
    "type": "EXCHANGE_CHECKOUT_SESSION",
    "code": "string"
}
headers = {
    "Content-Type": "application/json",
    "Idempotency-Key": "string",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "checkoutSession": {
    "token": "string",
    "expiresAt": "2019-08-24T14:15:22Z"
  },
  "expiresAt": "2019-08-24T14:15:22Z",
  "orderId": "string",
  "orderStatus": "DRAFT",
  "paymentUrl": "http://example.com",
  "status": "ACCEPTED",
  "type": "EXCHANGE_CHECKOUT_SESSION"
}
```

- `expiresAt` (`commerce.orders.actions.create.response.200.expiresAt`; any of, required)
  - any of the following: `string`, `null`
- `orderId` (`commerce.orders.actions.create.response.200.orderId`; string, required)
  - minLength: `1`
- `orderStatus` (`commerce.orders.actions.create.response.200.orderStatus`; string, required)
  - one of `"DRAFT"`, `"AWAITING_PAYMENT"`, `"HOLDING"`, `"HELD"`, `"PAYMENT_PROCESSING"`, `"TICKETING"`, `"BOOKED"`, `"CANCELLATION_PROCESSING"`, `"CANCELLED"`, `"EXPIRED"`, `"NEEDS_ATTENTION"`, `"FAILED"`
- `paymentUrl` (`commerce.orders.actions.create.response.200.paymentUrl`; any of, required)
  - any of the following: `string`, `null`
- `status` (`commerce.orders.actions.create.response.200.status`; string, required)
  - one of `"ACCEPTED"`, `"COMPLETED"`
- `type` (`commerce.orders.actions.create.response.200.type`; string, required)
  - one of `"EXCHANGE_CHECKOUT_SESSION"`, `"RENEW_CHECKOUT"`, `"SUBMIT_CHECKOUT"`, `"CREATE_PAYMENT_LINK"`, `"CONFIRM_NICER_PAYMENT"`, `"CANCEL"`, `"REVOKE_PAYMENT_LINK"`
- `checkoutSession` (`commerce.orders.actions.create.response.200.checkoutSession`; object, optional)
  - `token` (`commerce.orders.actions.create.response.200.checkoutSession.token`; string, required)
    - minLength: `1`
  - `expiresAt` (`commerce.orders.actions.create.response.200.checkoutSession.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))$`

### 400

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

#### Example

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

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

### 401

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

#### Example

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

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

### 403

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

#### Example

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

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


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