cart.calculateCart

This method is used to recalculate the Cart Promotions and Taxes. It contains the same sequence as the addToCart operation.

Version

v1

Arguments

This method has the path /cart/<version>/cart.calculateCart and follows the MicroBase API calling conventions.

Argument Required Type Example Description
cartId yes String H19PRsec The id of the Cart to calculate.

Response

Returns the complete cart:

{
  "ok": true,
  "cart": {
    "id": "H19PRsec",
    "status": "ACTIVE",
    "customerId": "ANON",
    "currency": "USD",
    "channel": "WEB",
    "expirationTime": "2018-05-31T15:12:54.096Z",
    "items": [
      {
        "id": "HJsKZud1X",
        "productId": "rylW3KZvJX",
        "title": "0001 - Gel Noosa Tri 11 (ASics)",
        "quantity": 3,
        "price": {
          "amount": 11900,
          "currency": "USD",
          "precision": 2
        },
        "taxes": [
          {
            "beforeTax": {
              "amount": 35700,
              "currency": "USD",
              "precision": 2
            },
            "tax": {
              "amount": 7497,
              "currency": "USD",
              "precision": 2
            },
            "taxDetail": "IVA 21%"
          }
        ],
        "discounts": [],
        "reserves": []
      }
    ],
    "promotions": {
      "almostFulfilledPromos": [],
      "fulfilledPromos": [],
      "ok": true
    },
    "taxes": {
      "ok": true,
      "beforeTax": {
        "amount": 35700,
        "currency": "USD",
        "precision": 2
      },
      "tax": {
        "amount": 7497,
        "currency": "USD",
        "precision": 2
      }
    }
  }
}

Errors

Expected errors that this method could return. Some errors return additional data.

Error Data Description
cart_not_found - The Cart was not found
validation_error The data causing the error Some validation error

Example

curl --request GET \
  --url http://localhost:3000/services/cart/v1/cart.calculateCart?cartId=H19PRsec \
  --header 'authorization: Bearer xxxxx...' \
  --header 'accept: application/json' \
  --header 'content-type: application/json'