---
title: "Create order from cart"
method: POST
path: "/checkout-orders"
tags: ["Checkout"]
---

# Create order from cart

`POST /checkout-orders`

## Request

- Base URL: `http://localhost:8000/api/shop`
- URL: `http://localhost:8000/api/shop/checkout-orders`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-shop-api/docs/checkout-orders/post.ts> (a function with typed inputs; its response is checked against the schema)

Finalizes checkout and creates an order from the current cart. The cart is identified by the Bearer token in the Authorization header; all address, shipping, and payment data must already be saved on the cart.

## Headers

- `X-STOREFRONT-KEY` string, required
- `X-Locale` string
- `X-Channel` string
- `X-Currency` string

## Request body

- object

## Response `201`

Order placed, or a payment redirect is required. Check the `redirect` flag: when it is false the order exists and `orderId` and `incrementId` (the order number to show the shopper) are set; when it is true no order has been created yet and the shopper must be sent to `redirectUrl` to pay — the order is created once the gateway returns.

## Other responses

- `400`: Invalid input
- `422`: Validation Error
- `500`: Cart not fully prepared (missing addresses/shipping/payment) or checkout failed.

---

[API](https://skmtc.dev/bagisto/apis/bagisto-shop-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-shop-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-shop-api/revisions/f619df36bf29?raw)
