shipping.create

This method is used to create a Shipping method.

Version

v2

Arguments

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

Argument Required Type Example Description
title yes String UPS Same Day Shipping method title.
active yes Boolean true Active or disabled.
taxCode no String vat-7 Tax code applicable to this shipping method. Defaults to 'default'.
rates yes Object List - List of rates by location.

Rates

Argument Required Type Example Description
locations yes Object List [{ "country": "SP" }] List of locations where this method is applicable.
rates yes Object List [{ "currency": "EUR", "amount": 10.10 }] List of rates.

Response

Returns a Shipping Method object:

{
  "ok" : true,
  "shipping" : {
    "id" : "iw3RA1EE",
    "title" : "UPS Same Day",
    "active" : true,
    "taxCode" : "default",
    "rates" : [
      {
        "id" : "QJSY863b",
        "locations" : [
          { "country" : "ES" },
          { "country" : "IT" },
          { "country" : "GB" }
        ],
        "rates": [
          {"currency" : "EUR", "amount" : 10.10},
          {"currency" : "GBP", "amount" : 9.90}
        ]
      },
      {
        "id" : "1sSf368D",
        "locations" : [
          { "country" : "US", "state" : "Hawaii" },
          { "country" : "US", "state" : "Alaska" }
        ],
        "rates" : [
          {"currency" : "USD", "amount" : 25.00}
        ]
      }
    ]
  }
}

Errors

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

Error Data Description
validation_error The data causing the error Some validation error
location_country_invalid The country code The country code is invalid
location_state_invalid The state The state is invalid for the country
rate_currency_invalid The currency code The currency code is not invalid

Example

curl --request POST \
  --url http://localhost:3000/services/cart/v1/shipping.create \
  --header 'authorization: Bearer xxxxx...' \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{...}'