Next Commerce

Carts Calculate

Calculate cart summary.

POST
/api/v1/carts/calculate/

Authorization

API Authentication
Authorization<token>

Campaign token based authentication.

In: header

Request Body

currency?|

ISO 4217 currency code (e.g., USD, EUR, GBP), defaults to the campaign currency if not provided

lines*array<>

Array of package IDs

shipping_method?integer

Selected shipping method ID

vouchers?array<>

Campaign offer codes or store coupon code

Response Body

application/json

curl -X POST "https://campaigns.apps.29next.com/api/v1/carts/calculate/" \
  -H "Authorization: " \
  -H "Content-Type: application/json" \
  -d '{
    "lines": [
      {
        "package_id": 0
      }
    ]
  }'
{
  "currency": "str",
  "lines": [
    {
      "discounts": [
        {
          "amount": "string",
          "description": "string",
          "name": "string",
          "offer_id": 0
        }
      ],
      "original_package_price": "string",
      "original_unit_price": "string",
      "package_id": 0,
      "package_price": "string",
      "quantity": 0,
      "subtotal": "string",
      "total": "string",
      "total_discount": "string",
      "unit_price": "string"
    }
  ],
  "offer_discounts": [
    {
      "amount": "string",
      "description": "string",
      "name": "string",
      "offer_id": 0
    }
  ],
  "shipping_method": {
    "code": "string",
    "discounts": [
      {
        "amount": "string",
        "description": "string",
        "name": "string",
        "offer_id": 0
      }
    ],
    "id": 0,
    "name": "string",
    "original_price": "string",
    "price": "string"
  },
  "subtotal": "string",
  "total": "string",
  "total_discount": "string",
  "voucher_discounts": [
    {
      "amount": "string",
      "description": "string",
      "name": "string",
      "offer_id": 0
    }
  ]
}