Validate Cart

​

Runs the checks that POST /cart/{cart_id}/checkout would run, without committing anything. Nothing about the stored cart changes, so you can call it as often as you like — on entering the checkout screen, for example, to find out whether the customer can proceed before you show them a payment form.

A failed check is still a 200. Read is_valid rather than the status code. The call only returns an error status when the cart itself cannot be loaded.

checks reports each group separately so you can tell which part failed. A group is skipped when it was not run: order_amount_limits is skipped if the cart check already failed, and house_account is skipped unless you ask for it.

Every failure is listed in issues, each with the check it came from, a stable code, and a title and message written for the customer. Show those rather than composing your own text.

The three order_amount_limits codes are fixed: order_amount_below_minimum, order_amount_exceeds_maximum and catering_minimum_not_reached. The cart check draws on a wider set of codes, so branch on check and display title and message rather than switching on every possible code.

Path Parameters

  • The cart identifier returned by POST /cart/init

Query Parameters

  • Also check that the customer's house account has enough credit for this cart. Off by default, because it is only meaningful on a brand that offers house accounts.

Headers

  • White Label Application Key

  • The release version your integration was built against — see Versioning in API Basics.

  • Required even on requests with no body

  • Bearer token of the signed-in customer. Omit it for an anonymous guest

  • Punchh customer token, on a brand integrated with Punchh. Authorization does not authenticate you to Punchh. Send it on every cart call for a signed-in registered customer — any cart with items triggers a loyalty calculation, with or without a discount — and for a guest only when the cart carries a reward, offer, credit or promo code. Omitting it falls back to the token stored for that customer at sign-in, which may be stale.

    Declared optional because it is conditional, not because it is safe to leave out. It applies only to a Punchh brand, so marking it required would be wrong for every brand without the integration. See Use Rewards, Offers, Customer Credits, and Promo Codes.

Body

application/json

No request body.

Responses

  • application/json
  • The brand is not on the new product structure (NMG).

  • Unknown cart ID, or the cart belongs to another brand or customer.

Request Example for post/cart/{cart_id}/validate
curl 'https://api-public-demo.menu.app/api/cart/f6ce31f7b7549cc7c3e5326661cf1dc3b5ea5c3fd89cce634667e483e23fb51a/validate?check_house_account_credit=false' \
  --request POST \
  --header 'Application: ' \
  --header 'Api-Version: ' \
  --header 'Content-Type: application/json'
{
  "status": "OK",
  "code": 200,
  "data": {
    "cart": {
      "id": "f6ce31f7b7549cc7c3e5326661cf1dc3b5ea5c3fd89cce634667e483e23fb51a"
    },
    "is_valid": true,
    "checks": {
      "cart": "ok",
      "order_amount_limits": "ok",
      "house_account": "skipped"
    },
    "issues": []
  }
}