# DeliveryMethod

An object representing a delivery method.

# Properties

Property Type Description
uid integer The unique identifier of the delivery method.
name object Name of the delivery method, by language.
description object Description of the delivery method, by language.
limitToCustomergroups array A list of Customergroup uid's which the delivery method are limited to. If the property is null then there are no limitation set.
freeDeliveryMinimumSpend object The minimum amount to spend on an order to get free delivery with this delivery method, by currency, as the buyer sees prices. See freeDeliveryMinimumSpend.
freeDeliveryMinimumSpendByVat object The same minimum amount excluding (exVat) and including VAT (incVat), by currency, whatever the buyer sees. See freeDeliveryMinimumSpend.
preferred boolean If this is the preferred delivery method according to the shop.
allowBulky boolean If this delivery method allows delivery of bulky articles.
allowCod boolean If this delivery method allows cash on delivery as a means to pay for the order.
codCountry string For which country cash on delivery is available for.
rates array An array of delivery rates. See Rates.
parcelTemplate object The packaging that parcels sent with this delivery method are packed in, or null if it has none. See ParcelTemplate. Only readable by admins.

# freeDeliveryMinimumSpend

freeDeliveryMinimumSpend holds the limit as the buyer sees prices: excluding VAT if the current order is paid without VAT, or, without an order, if prices are shown excluding VAT. It is kept as it was for existing clients.

freeDeliveryMinimumSpendByVat holds the limit excluding (exVat) and including VAT (incVat), by currency, whatever the buyer sees. Use it when the VAT basis matters.

The limit is stored either including or excluding VAT; the other figure is converted with the shop's default VAT rate and rounded like prices. A shop that does not handle VAT charges no VAT, so all figures are the stored limit. If the delivery method has no free delivery limit, freeDeliveryMinimumSpend is null, and so are exVat and incVat; like other empty values, they are left out unless asked for explicitly. exVat and incVat can be queried by currency, e.g. {"freeDeliveryMinimumSpendByVat": {"incVat": ["SEK"]}}.

Example for a buyer who sees prices including VAT, in a shop with 25 % VAT:

{
  "freeDeliveryMinimumSpend": {
    "SEK": 500
  },
  "freeDeliveryMinimumSpendByVat": {
    "exVat": {
      "SEK": 400
    },
    "incVat": {
      "SEK": 500
    }
  }
}

# ParcelTemplate

These are the properties for the parcelTemplate object.

Property Type Description
uid integer The unique identifier of the parcel template.
name string Name of the parcel template.
type string Type of parcel. One of: "PACKAGE", "PALLET_EUR", "HALF_PALLET_EUR", "QUARTER_PALLET", "OTHER".
unit string Unit of the dimensions, e.g. "cm".
width integer Width of the parcel.
height integer Height of the parcel.
length integer Length of the parcel.
weight integer Weight of the packaging in grammes.

# Rates

These are the properties for the rates object.

Property Type Description
name string Name of the delivery rate.
countryVatRates array VAT-rate, by country. See CountryVatRate.
weightIntervals array Weight intervals. See WeightInterval.

# CountryVatRate

Property Type Description
vatRate number VAT-rate.
states object VAT-rate, by state.

# WeightInterval

Property Type Description
weightMin number Minimum weight for the interval.
weightMax number Maximum weight for the interval.
price object Price for the interval, by currency.

# Methods

# count

Takes a filter object and returns the number of shipment methods found, as an integer.

# Parameters

A filter object specifying which shipment methods to count. See Filter objects on the page List selection.

# Example

The request below returns the number of delivery methods found where the name in English starts with "My delivery".

DeliveryMethod.count({
  "/name/en": {
    "startsWith": "My delivery"
  }
})

# get

Fetches information about a delivery method.

# Parameters

Parameter Description
uid The unique identifier of a shipment method.
query Which info to return. See Query language.

# Example

The request below returns the name of the shipment method with the unique identifier 123122.

DeliveryMethod.get(123122, [
  "name"
])

# getSchema

Fetches the JSON Schema which can be used for client-side validation.

# Parameters

The unique identifier of a shipment method or null for a new instance.

# list

Returns an array of objects representing delivery methods. Limited to administrators only.

# Parameters

Parameter Description
query A query object specifying what to fetch from each shipment method. This is the same as for get. See Query language.
selection A list selection specifying which shipment methods to fetch. See List selection.

# Example

The following request returns an array of max two delivery methods with the properties name and uid:

DeliveryMethod.list([
  "name",
  "uid"
], {
  "limit": 2
})

# set

Updates a delivery method.

# Parameters

Parameter Description
uid The unique identifier of a shipment method to update.
patch An object containing the properties and values to set for the shipment method.
query A query specifying what to return after a successful set (optional).

# validate

Validates the data to be set. The performed validation is the same as in set; it validates the resulting object and includes all the required properties. However, nothing is saved.

# Parameters

Parameter Description
uid The unique identifier of an existing shipment method or null.
patch An object containing the properties and values to set before validating.

# Returns

An array of validation-error objects, each containing the keys pointer (a property referenced using a JSON Pointer) and message (a readable text in the language of the context). If there are no validation errors, then an empty array is returned.