Carts over REST

API

The cart endpoints are part of Introducing the REST API, which walks through a whole order. This is the short version, for the cart calls alone.

What changed

EndpointWhat it does
POST /v1/cartsStarts a real build on the restaurant's site and answers 202 with a crt_ id. idempotencyKey is required.
GET /v1/carts/:idThe cart: status, items, fees, the card it will bill, and totalMinor, the one total.
POST /v1/carts/:id/answerThe person's answer to a choice or a next-day pickup. It builds a new cart.
POST /v1/carts/:id/confirmConfirms it with the cart's totalMinor. Answers placing, never placed.
POST /v1/carts/:id/confirm/resend-codeTexts a fresh code. A cart that needs no code answers 409 code_not_needed.
POST /v1/carts/:id/cancelReleases a ready cart.

The code

A live confirm asks for the 6-digit code Layout texts the person only when the person keeps codes on, the restaurant's total is over $50, Layout's risk checks ask for one, or a code is already out for this cart. Otherwise one confirm call places it. When a code is needed, confirm answers 400 code_required, and you send the same request again with code.

Who can confirm

A connected person's token confirms, resends and cancels. A live build grant builds and reads, and is refused 403 build_only on confirm and cancel: the person confirms in Layout. In sandbox a grant's confirm is a simulation that places and charges nothing.

What to do

Nothing, if you build over MCP. To use REST, read Carts.

Breaking changes

None. These are new endpoints.

All changes