# Shop checkout create

`POST /payments/checkouts` · Rivier · shop

Open a checkout for any reference (an order, a booking, an invoice, or your own id as other): the payment carries the reference and the payment events name it. Repeat with the same idempotency key to get the same checkout.

- Scope: shop:write
- Mcp: rivier_payments_checkout_create
- Graphql: Mutation.shopCheckoutCreate
- Sdk: shop.checkout.create
- Cli: shop checkout create

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "reference": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "order",
            "booking",
            "invoice",
            "reservation",
            "link",
            "other"
          ]
        },
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        }
      },
      "required": [
        "kind",
        "id"
      ],
      "additionalProperties": false
    },
    "amountMinor": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 99999999999
    },
    "currency": {
      "type": "string",
      "pattern": "^[a-z]{3}$"
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100000
          },
          "unitAmountMinor": {
            "type": "integer",
            "minimum": 0,
            "maximum": 99999999999
          }
        },
        "required": [
          "name",
          "quantity",
          "unitAmountMinor"
        ],
        "additionalProperties": false
      },
      "maxItems": 100,
      "default": []
    },
    "customer": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email"
        },
        "name": {
          "type": "string",
          "maxLength": 160
        }
      },
      "additionalProperties": false,
      "default": {}
    },
    "successUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 2000
    },
    "cancelUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 2000
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "capture": {
      "type": "string",
      "enum": [
        "automatic",
        "manual"
      ],
      "default": "automatic"
    },
    "saveMethod": {
      "type": "boolean",
      "default": false
    },
    "form": {
      "type": "string",
      "enum": [
        "hosted",
        "embedded",
        "headless"
      ],
      "default": "hosted"
    },
    "idempotencyKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    }
  },
  "required": [
    "reference",
    "amountMinor",
    "currency",
    "idempotencyKey"
  ],
  "additionalProperties": false
}
```

## Responses

- `201`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/payments/checkouts' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "reference": {
    "kind": "order",
    "id": "string"
  },
  "amountMinor": 0,
  "currency": "string",
  "idempotencyKey": "string"
}'
```
