---
id: get-selected-delivery-method
title: Get delivery selection after purchase
hide_title: true
description: "Get delivery selection after purchase"
---

import Ingress from '../../../src/components/ingress/ingress.react';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import GetMerchantInfoHappyPath from './examples/json-example-get-merchant-happy-path.mdx';
import GetMerchantInfoWithoutShipping from './examples/json-example-get-merchant-without-shipping.mdx';
import GetMerchantInfoWithFailedExternalShipment from './examples/json-example-get-merchant-without-external-shipment.mdx';
import GetMerchantInfoAfterFallback from './examples/json-example-get-merchant-after-fallback.mdx';

## Get the customer's selected delivery method

When [Acquiring Checkout Information](/docs/checkout/getcheckoutinformation), 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 four scenarios that can occur for the checkout session regarding the delivery selection:

1. We successfully received delivery methods 
    1. And successfully created external shipment.
    2. External shipment was not created, due to opting out of the optional feature or a technical issue.
2. We failed to receive delivery methods (and have therefore not been able to create any external shipment)
    1. And a [fallback shipment](./introduction-delivery-module#fallback-strategy-and-shipping-fees) was set during checkout initialization
    2. And no fallback shipment was set.

:::info
For scenario 1.2, the shipment will not have an externaShipmentId (null). However, all other relevant information will still be provided, allowing you to see where the customer intends to have their packages delivered (including the carrier and service point).

For scenario 2.2, the shipping object will not exist. You will need to manually create the shipment for your customer based on the delivery address. For this scenario, the delivery will always be free of charge for the customer.
:::

Below are examples of the JSON structure of the `shipping` object for the four scenarios.

<Tabs defaultValue="success" values={[
{ label: 'Scenario 1.1. Successfully created external shipment', value: 'success' },
{ label: 'Scenario 1.2. External shipment were not created', value: 'halfwaySuccess' },
{ label: 'Scenario 2.1. Failed to get delivery methods, with fallback', value: 'fallback' },
{ label: 'Scenario 2.2. Failed to get delivery methods, no fallback', value: 'no-fallback' },
]}>

<TabItem value="success">
  <GetMerchantInfoHappyPath/>
</TabItem>

<TabItem value="halfwaySuccess">
  :::info
  This can occur for different reasons:
  1. A technical issue occurred that prevented the creation of the external shipment.
  2. The creation of the external shipment was skipped (this occurs when using a custom delivery adapter, without the external shipment configuration).
  :::
  <GetMerchantInfoWithFailedExternalShipment/>
</TabItem>

<TabItem value="fallback">
  <GetMerchantInfoAfterFallback/>
</TabItem>

<TabItem value="no-fallback">
  <GetMerchantInfoWithoutShipping/>
</TabItem>

</Tabs>


### 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 `externalShipmentId`.

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](https://www.unifaunonline.se/rs-docs/##prepared_shipments_prepareId_shipments) how to activate the prepared shipment.

