Checkout Carts

Create a cart from inventory

Changed on

Creates a checkout cart for the account bound to the token and returns it with a checkout_url the buyer can be sent to. The account that owns the cart is resolved server-side from the token, so the request carries no owner identifiers. Buyer prefill is optional. The cart holds one dealer unit, named by inventory_id. The body takes no vehicle list, no accessory field, and no preorder flag, because a unit is a specific vehicle that already exists rather than a configuration to build. To sell a vehicle to be built instead, use POST /carts/build-to-order.

post/carts/inventory

Request

  • Base URL: https://api.ekho.com
  • URL: https://api.ekho.com/carts/inventory
  • Auth: HTTP bearer

Request body

inventory_idstring required

The inventory unit being sold. One unit per cart.

cancel_redirect_urlstring

URL the buyer is redirected to if they cancel checkout.

metadataobject

Free-form metadata carried through to the cart, and on to the order and its vehicles. Stored as written, so a nested object or an array needs no JSON encoding and reads back in the shape it was sent. At most 100 object keys and 2 levels of object nesting, and no array may hold another array.

promo_codesstring[]

Promotion codes, matched against the promotions published for your account. A code matching none is skipped rather than failing the request. At most 10. Matching runs after the cart is written, so a validate_only request reports nothing about them.

validate_onlyboolean

When true, the request is checked as a real one would be, then stops: no cart is created. A request that would have succeeded answers 200 with {"validate_only": true}; one that would have failed answers the same error. Reserves nothing, so a unit can still sell between a passing check and the create.

Example request

{
  "promo_codes": [
    "SPRING500"
  ]
}

Response

A validate_only request passed. No cart was created.

Example response

{
  "data": {
    "dropped_accessories": [
      {
        "id": "acc_rear_rack_black"
      }
    ]
  }
}

Changes

    • info

      added the required property / to the response with the status

    • info

      added the required property / to the response with the status

    • info

      added the new optional request property