xclade
Store APIShipping options

Calculate Shipping Option Price

Calculate the price of a shipping option in a cart.

POST
/store/shipping-options/{id}/calculate

Path Parameters

id*string

The shipping option's ID.

Query Parameters

fields?string

Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.

Header Parameters

x-publishable-api-key*string

Publishable API Key created in the Medusa Admin.

Request Body

application/json

cart_id*string

The ID of the cart the shipping option is used in.

data?object

Custom data that's useful for the fulfillment provider to calculate the price.

Response Body

application/json

application/json

text/plain

application/json

application/json

application/json

application/json

curl -X POST "https://{tenant}.api.myxclade.com/store/shipping-options/string/calculate" \  -H "x-publishable-api-key: string" \  -H "Content-Type: application/json" \  -d '{    "cart_id": "string"  }'
{
  "shipping_option": {
    "id": "string",
    "name": "string",
    "price_type": "flat",
    "service_zone_id": "string",
    "provider_id": "string",
    "provider": {
      "id": "string",
      "is_enabled": true
    },
    "type": {
      "id": "string",
      "label": "string",
      "description": "string",
      "code": "string"
    },
    "shipping_profile_id": "string",
    "amount": 0,
    "data": {},
    "prices": [
      {
        "id": "string",
        "currency_code": "usd",
        "amount": 0,
        "min_quantity": 0,
        "max_quantity": 0,
        "price_rules": [
          {
            "id": "string",
            "attribute": "string",
            "operator": "gt",
            "value": "string"
          }
        ]
      }
    ],
    "calculated_price": {
      "id": "string",
      "is_calculated_price_price_list": true,
      "is_calculated_price_tax_inclusive": true,
      "calculated_amount": 0,
      "calculated_amount_with_tax": 0,
      "calculated_amount_without_tax": 0,
      "is_original_price_price_list": true,
      "is_original_price_tax_inclusive": true,
      "original_amount": 0,
      "currency_code": "string",
      "calculated_price": {
        "id": "string",
        "price_list_id": "string",
        "price_list_type": "string",
        "min_quantity": 0,
        "max_quantity": 0
      },
      "original_price": {
        "id": "string",
        "price_list_id": "string",
        "price_list_type": "string",
        "min_quantity": 0,
        "max_quantity": 0
      },
      "original_amount_with_tax": 0,
      "original_amount_without_tax": 0
    },
    "insufficient_inventory": true
  }
}

{
  "message": "Discount must be set to dynamic",
  "type": "not_allowed"
}

"Unauthorized"
{
  "message": "Entity with id 1 was not found",
  "type": "not_found"
}
{
  "code": "unknown_error",
  "message": "The request conflicted with another request. You may retry the request with the provided Idempotency-Key.",
  "type": "QueryRunnerAlreadyReleasedError"
}
{
  "code": "invalid_request_error",
  "message": "Discount with code TEST already exists.",
  "type": "duplicate_error"
}

{
  "code": "api_error",
  "message": "An error occured while hashing password",
  "type": "database_error"
}