# Place the order and, unless told not to, start the payment

`POST /public/shop/checkout` · Rivier · shop

Place the order and, unless told not to, start the payment; answers with the order, its link and the payment address.

- Scope: shop:read
- Sdk: shop.publicCheckout.place
- Cli: shop public checkout place
- Publishable: yes

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "cartId": {
      "type": "string",
      "format": "uuid"
    },
    "contact": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "maxLength": 254
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "phone": {
          "type": "string",
          "maxLength": 40
        }
      },
      "required": [
        "email",
        "name"
      ],
      "additionalProperties": false
    },
    "shippingAddress": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "line1": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "line2": {
          "type": "string",
          "maxLength": 200
        },
        "city": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "region": {
          "type": "string",
          "maxLength": 10,
          "default": ""
        },
        "postalCode": {
          "type": "string",
          "minLength": 1,
          "maxLength": 20
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        "phone": {
          "type": "string",
          "maxLength": 40
        }
      },
      "required": [
        "name",
        "line1",
        "city",
        "postalCode",
        "country"
      ],
      "additionalProperties": false
    },
    "billingAddress": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "line1": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "line2": {
          "type": "string",
          "maxLength": 200
        },
        "city": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "region": {
          "type": "string",
          "maxLength": 10,
          "default": ""
        },
        "postalCode": {
          "type": "string",
          "minLength": 1,
          "maxLength": 20
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        "phone": {
          "type": "string",
          "maxLength": 40
        }
      },
      "required": [
        "name",
        "line1",
        "city",
        "postalCode",
        "country"
      ],
      "additionalProperties": false
    },
    "shippingRateId": {
      "type": "string",
      "format": "uuid"
    },
    "idempotencyKey": {
      "type": "string",
      "minLength": 8,
      "maxLength": 120
    },
    "returnUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 500
    },
    "agent": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 100
        },
        "model": {
          "type": "string",
          "maxLength": 100
        },
        "runId": {
          "type": "string",
          "maxLength": 100
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "pay": {
      "type": "boolean"
    }
  },
  "required": [
    "cartId",
    "contact",
    "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/public/shop/checkout' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "cartId": "string",
  "contact": {
    "email": "name@example.com",
    "name": "string"
  },
  "idempotencyKey": "string"
}'
```
