Skip to main content
POST
/
store
/
carts
/
{id}
/
shipping-methods
curl -X POST 'http://localhost:9000/store/carts/cart_01JB2KB1CD/shipping-methods' \
  -H 'Content-Type: application/json' \
  -H 'x-publishable-api-key: pk_01JB2K3XYZ' \
  -d '{"option_id": "so_01JB2KC4GH"}'
{
  "cart": {
    "id": "cart_01JB2KB1CD",
    "currency_code": "eur",
    "items": [{ "id": "cali_01JB2KB3EF", "quantity": 1, "unit_price": 4500 }],
    "shipping_methods": [
      {
        "shipping_option_id": "so_01JB2KC4GH",
        "amount": 900,
        "is_tax_inclusive": false,
        "tax_lines": []
      }
    ],
    "shipping_total": 900,
    "total": 5400
  }
}
Adds the chosen shipping option to the cart through Mercur’s seller-aware workflow, so each seller’s items can carry their own shipping method.

Path parameters

id
string
required
The cart’s ID.

Query parameters

fields
string
Comma-separated fields and relations to include on the returned cart; prefix with +/- to add to or remove from the defaults.

Body parameters

option_id
string
required
ID of the shipping option to add.
data
object
Provider-specific data forwarded to the fulfillment provider.
additional_data
object
Data passed to the workflow’s hooks.

Response

cart
object
curl -X POST 'http://localhost:9000/store/carts/cart_01JB2KB1CD/shipping-methods' \
  -H 'Content-Type: application/json' \
  -H 'x-publishable-api-key: pk_01JB2K3XYZ' \
  -d '{"option_id": "so_01JB2KC4GH"}'
{
  "cart": {
    "id": "cart_01JB2KB1CD",
    "currency_code": "eur",
    "items": [{ "id": "cali_01JB2KB3EF", "quantity": 1, "unit_price": 4500 }],
    "shipping_methods": [
      {
        "shipping_option_id": "so_01JB2KC4GH",
        "amount": 900,
        "is_tax_inclusive": false,
        "tax_lines": []
      }
    ],
    "shipping_total": 900,
    "total": 5400
  }
}