API Reference

CheckoutShopping Cart
Simulate a shopping cart

The shopping cart is where the information on the products chosen by the customer while browsing a store is gathered. This data may include item prices, shipping value, payment, and delivery methods, among others.

This guide will describe the process of simulating a shopping cart at Checkout.

Simulating a shopping cart

The first step is to send the parameters you want to be in the cart. This can be done via the Cart Simulation endpoint's request body.

See a request body example below:

{ "items": [ { "id": "1", "quantity": 1, "seller": "1" } ], "country": "BRA" }

️ The fields id, quantity, seller, and country are just examples of content that you can simulate in your cart. You can add more fields to the request as per your need. Access the orderForm overview to check the available fields.

After sending the request, the endpoint will return the response body containing the shopping cart information, as shown in the example below:

"items": [ { "id": "1", "requestIndex": 0, "quantity": 1, "seller": "1", "sellerChain": [ "1" ], "tax": 0, "priceValidUntil": "2023-09-28T11:53:03Z", "price": 9999, "listPrice": 13499, "rewardValue": 0, "sellingPrice": 2999700, "offerings": [], "priceTags": [], "measurementUnit": "un", "unitMultiplier": 300.0000, "parentItemIndex": null, "parentAssemblyBinding": null, "availability": "available", "catalogProvider": "vrn:vtex.catalog-api-proxy:-:lojadobreno:master:/proxy/authenticated/catalog/pvt/sku/stockkeepingunitbyid/1", "priceDefinition": { "calculatedSellingPrice": 2999700, "total": 2999700, "sellingPrices": [ { "value": 2999700, "quantity": 1 } ] } } ], ...

Error codes

The following errors may appear as a message in the response body.

200 - OK

Despite the code 200 (which indicates the success of the request), if the item id sent is incorrect or unavailable, the following message will appear.

  • Message error example (code ORD027): "Item 5550 não encontrado ou indisponível" (item 5550 not found or unavailable).
"messages": [ { "code": "ORD027", "text": "Item 5550 não encontrado ou indisponível", "status": "error", "fields": { "id": "5550" } } ]

400 - Bad Request

The Bad Request error appears for several reasons, such as when a mandatory field was not filled in correctly (eg seller) or the item quantity was not specified. In addition to the 400 error code, an additional code will be shown to indicate the type of error.

  • Message error example (code ORD005): "O campo Id do item é obrigatório" (item ID field is required).
{ "fields": {}, "error": { "code": "ORD005", "message": "O campo Id do item é obrigatório", "exception": null }, "operationId": "5ac2e42e-0967-43b3-b0b4-dcbc6da118b1" }
  • Message error example (code CHK0024): "Id de vendedor de item inválido" (invalid item seller id).
{ "fields": {}, "error": { "code": "CHK0024", "message": "Id de vendedor de item inválido", "exception": null }, "operationId": "7adbc4af-32c8-4365-9f7e-c40ffc9ccf5a" }

404 - Not Found

  • Message error example: "The requested URL was not found on the server". Check that the URL data is correct.
<body> <h1>404 Not Found</h1> <p>The requested URL was not found on this server.</p> </body>
Photo of the contributor
+ 1 contributors
Was this helpful?
Suggest edits (Github)
Photo of the contributor
+ 1 contributors
On this page