Shipping Details in Kustom Checkout
How we handle shipping in KCO.
How it is done
There are several ways shipping can be added to an order and below we will explain the differences.
Using the same address for billing and shipping
Creating an order without specifying the property options.allow_separate_shipping will not have the shipping section of checkout visible and the shipping_address of the completed order will always be the same as the billing address.
With this order configuration KSA is disabled.
{
"purchase_country": "GB",
"purchase_currency": "GBP",
"locale": "en-GB",
"order_amount": 50000,
"order_tax_amount": 4545,
"order_lines": [{
"type": "physical",
"reference": "19-402-USA",
"name": "Red T-Shirt",
"quantity": 5,
"quantity_unit": "pcs",
"unit_price": 10000,
"tax_rate": 1000,
"total_amount": 50000,
"total_discount_amount": 0,
"total_tax_amount": 4545
}],
"merchant_urls": {
"terms": "https://www.example.com/terms.html",
"checkout": "https://www.example.com/checkout.html?order_id={checkout.order.id}",
"confirmation": "https://www.example.com/confirmation.html?order_id={checkout.order.id}",
"push": "https://www.example.com/api/push?order_id={checkout.order.id}"
}
}

Allowing a separate shipping address
An order that is created with allow_separate_shipping true will have the KSA visible in Checkout if the "Merchant Portal" configuration is set properly. This will allow the consumer to enter a separate shipping address.
{
"purchase_country": "GB",
"purchase_currency": "GBP",
"locale": "en-GB",
"order_amount": 50000,
"order_tax_amount": 4545,
"order_lines": [{
"type": "physical",
"reference": "19-402-USA",
"name": "Red T-Shirt",
"quantity": 5,
"quantity_unit": "pcs",
"unit_price": 10000,
"tax_rate": 1000,
"total_amount": 50000,
"total_discount_amount": 0,
"total_tax_amount": 4545
}],
"merchant_urls": {
"terms": "https://www.example.com/terms.html",
"checkout": "https://www.example.com/checkout.html?order_id={checkout.order.id}",
"confirmation": "https://www.example.com/confirmation.html?order_id={checkout.order.id}",
"push": "https://www.example.com/api/push?order_id={checkout.order.id}"
},
"options": {
"allow_separate_shipping_address": true,
}
}

Sending shipping options
As a merchant you can provide KCO with shipping_options you want to present to the consumer. These are sent in using the property shipping options . This will enable KSA if the "Merchant Portal" configuration is set properly which will present a shipping selector in the checkout where the consumer can select a shipping option and the cart will be updated automatically.
{
"purchase_country": "GB",
"purchase_currency": "GBP",
"locale": "en-GB",
"order_amount": 50000,
"order_tax_amount": 4545,
"order_lines": [{
"type": "physical",
"reference": "19-402-USA",
"name": "Red T-Shirt",
"quantity": 5,
"quantity_unit": "pcs",
"unit_price": 10000,
"tax_rate": 1000,
"total_amount": 50000,
"total_discount_amount": 0,
"total_tax_amount": 4545
}],
"merchant_urls": {
"terms": "https://www.example.com/terms.html",
"checkout": "https://www.example.com/checkout.html?order_id={checkout.order.id}",
"confirmation": "https://www.example.com/confirmation.html?order_id={checkout.order.id}",
"push": "https://www.example.com/api/push?order_id={checkout.order.id}"
},
"shipping_options": [{
"id": "free",
"name": "DHL",
"description": "Delivers in 5-7 days",
"promo": "",
"price": "0",
"tax_amount": "0",
"tax_rate": "0",
"shipping_method": "Home",
"preselected": true
}, {
"id": "",
"name": "ups",
"description": "",
"promo": "",
"price": "30",
"tax_amount": "",
"tax_rate": "",
"shipping_method": "Home"
}]
}

Allowing separate shipping & sending shipping options
If you specify both the options.allow_separate_shipping property and send in shipping_options the consumer will be able to choose a shipping option and a shipping address.
{
"purchase_country": "GB",
"purchase_currency": "GBP",
"locale": "en-GB",
"order_amount": 50000,
"order_tax_amount": 4545,
"order_lines": [{
"type": "physical",
"reference": "19-402-USA",
"name": "Red T-Shirt",
"quantity": 5,
"quantity_unit": "pcs",
"unit_price": 10000,
"tax_rate": 1000,
"total_amount": 50000,
"total_discount_amount": 0,
"total_tax_amount": 4545
}],
"merchant_urls": {
"terms": "https://www.example.com/terms.html",
"checkout": "https://www.example.com/checkout.html?order_id={checkout.order.id}",
"confirmation": "https://www.example.com/confirmation.html?order_id={checkout.order.id}",
"push": "https://www.example.com/api/push?order_id={checkout.order.id}"
},
"options": {
"allow_separate_shipping_address": true,
},
"shipping_options": [{
"id": "free",
"name": "Free Shipping",
"description": "Delivers in 5-7 days",
"promo": "",
"price": "0",
"tax_amount": "0",
"tax_rate": "0",
"shipping_method": "BoxUnreg",
"preselected": true
}, {
"id": "pickup",
"name": "Pick up at closest store",
"description": "",
"promo": "",
"price": "399",
"tax_amount": "30",
"tax_rate": "825",
"shipping_method": "PickUpStore"
}]
}
Shipping option update callback
You can specify a shipping_option_update url to get a server-side callback whenever the consumer changes the shipping option. Read more .
When this callback is used the shipping option cost will not be added automatically to the order_lines
or the order_total
of the order and this will be your responsibility.
Using a transport management system
If you want to use a transport management system (TMS), please see KSA documentation.
Read more
The Shipping Assistant have more documentation on the topic and a special section about Checkout integration, read more about KSA.