Init Cart
The cart initialization process allows customers to start a cart session. At the start, the cart is empty. A cart is initiated by calling this endpoint. Each cart is assigned a unique identifier (cart ID).
Called with a customer Authorization token, it returns that customer's cart, so repeat calls give the same id. Called without one, each call creates a new guest cart unless you send guest_cart_id to pick up a previous one.
The body is optional. Send it when a guest signs in with items already in their cart, or when the customer arrived through Google — see the fields below.
Headers
- Type: stringApplicationrequired
White Label Application Key
Body
Optional. Omit the body entirely for a plain new cart.
- Type: stringguest
_cart _id The id of a guest cart to carry over. With a customer
Authorizationtoken the guest cart becomes the customer's cart, keeping its items. Without a token it re-opens that guest cart under the same id, so retries after a lost session keep working. The cart must be a guest cart from the same brand, or the request fails. - Type: stringrwg
_token max length:8192The
rwg_tokenGoogle appends to the URL when a customer arrives from an "Order online" button on Google Search or Maps. Store it on the cart so the resulting order is reported back to Google. Can also be set later throughmetadata.rwg_tokenon Update Cart.
Responses
- application/json
- 400
Cart could not be initialized
curl https://api-public-demo.menu.app/api/cart/init \
--request POST \
--header 'Application: ' \
--header 'Content-Type: application/json' \
--data '{
"guest_cart_id": "3f1c9a8e2b7d4c6f0a5e9b1d8c7f6a2e4b3d9c8f1a0e7b6d5c4f3a2e1b0d9c8f"
}'
{
"status": "OK",
"code": 200,
"data": {
"cart": {
"id": "f6ce31f7b7549cc7c3e5326661cf1dc3b5ea5c3fd89cce634667e483e23fb51a",
"is_empty": true
}
}
}