Skip to main content

Custom Delivery Adapter

If you want total control of the provided delivery methods, you can build and host an own adapter that will empower Walley Checkout with delivery methods. This allows you to separate the items in the cart in multiple shipments, set specific pickup/delivery dates, add options to each delivery etc.

How to get started πŸš€β€‹

  1. Contact Walley Merchant Services for help with setup in our test environment and for questions regarding integration with the Delivery Module.
  2. Build a delivery adapter (api) with an endpoint that Walley Checkout will do a GET request towards to get the delivery methods that should respond according to the response below. Use basic auth as authentication.
  3. Provide Walley Merchant Services with the adapter endpoint url, basic auth credentials as well as what fallback strategy to use.

Default Request Query Parameters​

Below are the default query parameters that are always included when fetching delivery methods.

ParameterExplanation
privateIdThe checkout's private id which can be used to fetch information about the checkout
storeIdThe storeId for the checkout session
currencyCurrency used for the checkout session
languageThe display language used for the checkout session. Supported language are: sv, no, fi, da, en
countryCodeThe country code for the customer's current delivery address
postalCodeThe postal code for the customer's current delivery address
cartPriceThe total price for cart
cartWeightThe total weight for the cart, sum of all the article's weights sent in set cart request
emailThe customer's email address
addressThe address for the customer's current delivery address
storeTypeCustomerType for the checkout session, b2b or b2c

Adapter response​

The response can contain a lot of data and options that will be available for the customer, but not many of them are required. Here is an example of a successful response as well as an error response.

Response header​

HeaderRequiredExplanation
ExpiresNoA DateTime set if the choices should be valid only for a certain time. We will force the customer to reload delivery methods if a selection is made with delivery methods that has expired. Supported formats are RFC-7234 or .NET DateTimeOffset for example "Tue, 01 Jan 2002 00:00:00 GMT" or "2002-01-01 00:00:00 +00:00". If the header cannot be parsed, no expiration date is used

Response body​

PropertyRequiredExplanation
shipmentsYesArray of shipments, at least one must be present

Shipment Property

PropertyRequiredExplanation
idYesId of the shipment
nameYesName of shipment, will be displayed as a header for the entire shipment selection
shippingChoicesYesArray of choices that the customer can choose from for the shipment, at least one must be present
metadataNoAny metadata for the delivery, will not be used in checkout but returned every time you acquire checkout information
infoNoShipment specific info for costumer with a title and description

Info Property

PropertyRequiredExplanation
titleYesInformational title regarding shipment
descriptionYesInformational text regarding shipment

ShippingChoice Property

PropertyRequiredExplanation
idYesId of the choice
nameYesName of the choice, will be the title for the selection
descriptionNoDescription of the choice, will be the subtitle for the selection
iconNoIcon for the choice. Available icon propery values can be found below. If none is provided, a default icon will be used.
feeNoFee for the option, if combined with destinations and/or options, this fee will be added to all of them
destinationsNoArray of destinations that will be a subselection for the shipping choice
optionsNoArray of options that the customer can add optionally to add to the shipping choice
metadataNoAny metadata for the shipping choice, will not be used in checkout but returned every time you acquire checkout information
badgesNoArray of Badges with text and color for information regarding shipping choice

Destinations Property

PropertyRequiredExplanation
idYesId of the destination
nameYesName of the destination, will be the title of the selectable destination
descriptionNoDescription of the destination, will be the subtitle of the selectable destination
deliveryDatesNoArray of available delivery dates for the destination
metadataNoAny metadata for the destination, will not be used in checkout but returned every time you acquire checkout information

DeliveryDate Property

PropertyRequiredExplanation
dateYesDateTime of the selectable delivery date
timeFromYesTime of the day from where the selectable delivery date option starts
timeToYesTime of the day from where the selectable delivery date option ends
feeNoFee for the specified delivery date
metadataNoAny metadata for the delivery date, will not be used in checkout but returned every time you acquire checkout information

Option Property

PropertyRequiredExplanation
idYesId of the option
descriptionYesDescription of the option
typeYesType of the option, available types: "bool" - checkbox, "string" - text field, "number" - digits only
metadataNoAny metadata for the option, will not be used in checkout but returned every time you acquire checkout information

Badge Property

PropertyRequiredExplanation
textYesBadge text
colorNoBadge color

Badges​

Each shipping choice can have multiple badges with text and predefined color. These can be used to add extra information regarding a shipment, such as faster or environmentally friendly shipping. Below are the available colors.

Color property valueIcon
default
Default
discrete
Discrete
red
Red
green
Green
yellow
Yellow
blue
Blue

Icons​

The icons for a shippingChoice can either have a company logo or a generic icon. Below are the available icons:

Icon property valueIconIcon property valueIcon
postnordPostNordwalley-homeWalley-Home
dbschenkerSchenkerwalley-mailWalley-Mail
dhlDHLwalley-planeWalley-Plane
airmeeAirmeewalley-shipWalley-Ship
bestBestwalley-storeWalley-Store
bringBringwalley-truckWalley-Truck
budbeeBudbeedefault *Walley-Default
citymailCityMail
dsvDSV
earlybirdEarlyBird
helthjemHelthjem
instaboxInstabox
postiPosti
gordonGordon
doorisDooris
movebybikeMoveByBike

*Default icon is used if no value is provided, or if the value mismatches with any of the available icon property values.

Error message response​

If the GET-request is received successfully but no delivery methods can be returned, you can choose to return a non-2xx response with the following properties to inform the customer what is wrong and what action to take. This requires the fallback strategy to be set to true.

PropertyRequiredExplanation
titleNoThe title of the failure displayed in the Checkout. Truncated to a maximum of 512 characters.
messageNoThe message with a more descriptive text why no delivery methods was found, and how the customer should proceed. Truncated to a maximum of 512 characters.

A default message will be shown if not overridden with title and message from the response. Both title and message must be specified in the response to be used.

Response examples​

/*
Expires: "Tue, 01 Jan 2002 00:00:00 GMT"
*/

{
"shipments": [
{
"id": "shipmentId-1",
"name": "Delivery 1",
"info": {
"title": "Delivery time affected",
"description": "Your cart contains sensitive items which may affect delivery time"
},
"metadata": {
"key-for-shipment": "metadata-for-shipment",
"from-store-id": "1234"
},
"shippingChoices": [
{
"id": "choiceId-1",
"name": "Pickup in store",
"icon": "walley-store",
"description": "Pick up your order within five days from your chosen day for pick up",
"badges": [
{
"text": "Express delivery",
"color": "red"
}
],
"destinations": [
{
"id": "destinationId-gothenburg",
"name": "Gothenburg",
"description": "Kortedala",
"deliveryDates": [
{
"date": "2021-02-25T00:00:00+00:00",
"timeFrom": "07:00",
"timeTo": "17:00",
"fee": 0.0,
"metadata": {
"duringOpenHours": "true"
}
},
{
"date": "2021-02-25T00:00:00+00:00",
"timeFrom": "17:00",
"timeTo": "21:00",
"fee": 250.0,
"metadata": {
"duringOpenHours": "true"
}
},
{
"date": "2021-02-25T00:00:00+00:00",
"timeFrom": "21:00",
"timeTo": "22:00",
"fee": 500.0,
"metadata": {
"duringOpenHours": "false"
}
},
{
"date": "2021-02-26T00:00:00+00:00",
"timeFrom": "07:00",
"timeTo": "17:00",
"fee": 100.0
},
{
"date": "2021-03-01T00:00:00+00:00",
"timeFrom": "07:00",
"timeTo": "17:00",
"fee": 0.0
}
]
},
{
"id": "destinationId-varberg",
"name": "Varberg",
"description": "Hunnestad",
"deliveryDates": [
{
"date": "2021-02-28T00:00:00+00:00",
"timeFrom": "09:00",
"timeTo": "16:00",
"fee": 0.0
},
{
"date": "2021-02-28T00:00:00+00:00",
"timeFrom": "16:00",
"timeTo": "18:00",
"fee": 250.0
}
]
}
],
"fee": 0,
"options": [
{
"id": "option-1",
"description": "Rent trailer",
"type": "bool",
"fee": 500
},
{
"id": "option-2",
"description": "Help to pack",
"type": "bool",
"fee": 250
},
{
"id": "option-3",
"description": "Additional information",
"type": "string",
"fee": 0
}
]
},
{
"id": "choiceId-2",
"name": "Home delivery",
"icon": "walley-home",
"description": "Goods will be delivered as close to your home as possible",
"badges": [
{
"text": "Lightning fast!",
"color": "yellow"
},
{
"text": "Environmentally friendly",
"color": "green"
},
{
"text": "Carried to your door",
"color": "red"
}
],
"destinations": [
{
"id": "destinationId-home",
"name": "The most comfortable delivery",
"description": "Select day for delivery",
"deliveryDates": [
{
"date": "2021-03-11T00:00:00+00:00",
"timeFrom": "07:00",
"timeTo": "17:00",
"fee": 200.0
},
{
"date": "2021-03-12T00:00:00+00:00",
"timeFrom": "07:00",
"timeTo": "17:00",
"fee": 50.0
}
]
},
{
"id": "destinationId-home-express",
"name": "Express - a lot faster",
"description": "When you are in a hurry",
"fee": 500,
"deliveryDates": [
{
"date": "2020-10-01T00:00:00+00:00",
"timeFrom": "08:00",
"timeTo": "18:00"
}
]
}
],
"fee": 500,
"options": [
{
"id": "option1",
"description": "Notify when delivered",
"type": "bool",
"fee": 500
}
]
},
{
"id": "choiceId-3",
"name": "Pick up at service point with Postnord",
"icon": "postnord",
"description": "Select service point",
"badges": [
{
"text": "At your own leisure",
"color": "default"
},
{
"text": "Environmentally friendly",
"color": "green"
}
],
"destinations": [
{
"id": "service-point-1",
"description": null,
"name": "Postnord store, Avenyn"
},
{
"id": "service-point-2",
"description": null,
"name": "Postnord store, Backa"
}
],
"fee": 29
},
{
"id": "choiceId-4",
"name": "Pick up at service point with Schenker",
"icon": "dbschenker",
"description": "Select service point",
"badges": [
{
"text": "Pick up",
"color": "green"
}
],
"destinations": [
{
"id": "service-point-1",
"description": null,
"name": "Schenker store, Avenyn"
},
{
"id": "service-point-2",
"description": null,
"name": "Schenker store, Backa"
}
],
"fee": 29
},
{
"id": "choice-without-destination",
"name": "Pick up at central warehouse, Kalmar",
"icon": "walley-store",
"description": "Kalmar street 8",
"destinations": null,
"fee": 100
}
]
},
{
"id": "shipmentId-2",
"name": "Delivery 2",
"info": {
"title": "Longer delivery time",
"description": "Your cart contains items which are not in stock, this may affect delivery times"
},
"shippingChoices": [
{
"id": "choice-home-delivery",
"name": "Home delivery",
"icon": "walley-home",
"badges": [
{
"text": "Lightning fast!",
"color": "yellow"
},
{
"text": "Environmentally friendly",
"color": "green"
}
],
"destinations": [
{
"id": "standard-home-delivery",
"description": "Delivery within 5-7 days",
"name": "Standard, the most comfortable delivery"
},
{
"id": "express-home-delivery",
"description": "Delivery within 2 days",
"name": "Express - a lot faster",
"fee": 500
}
],
"fee": 1500,
"options": [
{
"id": "option1",
"description": "Bring my old stuff out",
"type": "bool",
"fee": 500
}
]
},
{
"id": "choice-without-destination-2",
"name": "Pick up at warehouse",
"icon": "walley-store",
"destinations": null,
"fee": 100
}
]
}
]
}

The 200-response from the example above will render the following delivery methods to the customer.