Skip to main content

Get the customer's selected delivery method​

When Acquiring Checkout Information, a data.shipping object will be available that will reflect the customer's current delivery selection. If this value is null, there are no selection at that current state of the checkout. After purchase the selections are included in the order.

There will be three scenarios that can occur for the checkout session regarding the delivery selection:

  1. We successfully received delivery methods and successfully created prepared shipments.
  2. We successfully received delivery methods but failed to create prepared shipments.
  3. We failed to receive delivery methods and have not been able to create any prepared shipment.
Please note

For scenario 2, the shipment will not have an bookedShipmentId (null). The rest of the information will be provided though, so you will be able to see where the customer intends to get his/hers packages delivered (carrier and servicePoint).

For scenario 3, the shipping object will not exist which means~~~~ that you must handle this manually and create a shipment for your customer based on the delivery address. Also note that the delivery will always be free of charge for the customer.

Below are examples of the JSON structure of the shipping object specific to nShift DeliveryCheckout for the three scenarios.

// Simplified Get Checkout Information response with focus on shipping and order object
{
"id": "9eec015f-4b97-44be-a711-d22f3af75069",
"data": {
"customer": {...},
...,
...,
"status": "PurchaseCompleted",
"order": {
"totalAmount": 2757,
"items": [
{
"id": "11111",
"description": "Item one",
"unitPrice": 5,
"quantity": 1,
"vat": 25,
"sku": "Item one sku"
},
{
"id": "222222",
"description": "Item two",
"unitPrice": 2,
"quantity": 1,
"vat": 25,
"sku": "Item two sku"
},
{
"id": "Frakt-1",
"description": "Pickup in store",
"unitPrice": 750,
"quantity": 1,
"vat": 25
},
{
"id": "Frakt-2",
"description": "Home delivery",
"unitPrice": 2000,
"quantity": 1,
"vat": 25
}
]
},
"shipping": {
"provider": "DeliveryAdapterName",
"shippingFee": 2750,
"shipments": [
{
"id": "shipmentId-1",
"bookedShipmentId": "ABC",
"feeItemId": "Frakt-1",
"metadata": {
"key-for-shipment": "metadata-for-shipment",
"from-store-id": "1234"
},
"shippingChoice": {
"id": "choiceId-1",
"name": "Pickup in store",
"fee": 0,
"metadata": {
"key-for-choice-1": "metadata-for-choice-1"
},
"destination": {
"id": "destinationId-gothenburg",
"name": "Gothenburg",
"fee": 0,
"metadata": {
"key-for-destination": "metadata-for-destination"
},
"deliveryDate": {
"fee": 0,
"metadata": {
"duringOpenHours": "true"
},
"date": "2021-02-25",
"timeFrom": "07:00",
"timeTo": "17:00"
}
},
"options": [
{
"id": "option-1",
"description": "Rent trailer",
"type": "bool",
"fee": 500,
"value": true
},
{
"id": "option-2",
"description": "Help to pack",
"type": "bool",
"fee": 250,
"value": true
},
{
"id": "option-3",
"description": "Additional information",
"type": "string",
"fee": 0,
"value": "Some info"
}
]
}
},
{
"id": "shipmentId-2",
"bookedShipmentId": "DEF",
"name": "Home delivery",
"feeItemId": "Frakt-2",
"metadata": null,
"shippingChoice": {
"id": "choice-home-delivery",
"fee": 1500,
"metadata": null,
"destination": {
"id": "standard-home-delivery",
"name": "Standard, the most comfortable delivery",
"fee": 0,
"metadata": null,
"deliveryDate": null
},
"options": [
{
"id": "option1",
"description": "Bring my old stuff out",
"type": "bool",
"fee": 500,
"value": true
}
]
}
}
]
},
...
},
"error": null
}

nShift Delivery Adapter​

If using nShift Delivery Adapter, Walley Checkout will attempt to create a prepared shipment at nShift that is not yet activated. When we do this we get a prepareId from nShift that we will hand over to you as bookedShipmentId.

When the package is ready to be delivered, you need to activate the delivery by sending a request to nShift with this prepareId. See nShift's documentation how to activate the prepared shipment.