Tax handling is important as Checkout will validate this and throw an error if it not correct.
Please see the order_lines API reference for information about tax calculations and fields.
The business logic for both tax calculations and the selection of shipping options is specific to each merchant:
KCO allows the merchant to:
If the customer only enters one address in KCO it will serve as both billing and shipping address.
The process of updating tax and shipping consists of three phases:
When the shipping address is changed a POST request is sent to the callback url specified by the merchant.
The body of the request contains:
shipping_address
order_amount
order_tax_amount
order_lines
The order_amount
, order_tax_amount
and order_lines
make up the cart object.
The merchant responds to the request. As a merchant you can choose to update:
The response is handled:
If so, a message is displayed to the customer telling them that something went wrong and that they can try again. This will be logged for merchant support.
selected_shipping_option
.type
- shipping_fee<tt>name</tt>
- name of the shipping optionIf you provide the address_update URL as part of the merchant_urls a POST request will be sent to that URL when the customer enters or edits the shipping address.
The body of the POST request will contain these fields:
order_amount
order_tax_amount
order_lines
billing_address
shipping_address
<span>selected_shipping_option</span>
Example of the POST request:
The response to the POST request should contain updated order_amount,``order_tax_amount
, and order_lines
fields with tax amount and shipping costs added as order lines and to the total amount.
Note: During the callback the order will be locked for changes using the regular update call. Any updates must be done by responding to the callback
Example response:
The Checkout allows the display and selection of shipping options as part of the Checkout flow. The shipping options may to be provided both at order creation and dynamically when the customer enters or changes the shipping address. The shippping options are provided as list a of shipping_option objects.
By providing shipping options at order creation the shipping options will be displayed to the customer regardless of the address they enter.
Shipping options provided at order creation can be updated or removed dynamically using the callback described below. Example of the shipping_options
field:
You will then receive the selected shipping option in the selected_shipping_option
field as part of the completed order. The shipping cost will be added to the total amounts and the selected shipping option will be added to the order lines.
Example:
Shipping options can be dynamically added, updated, or removed when the customer changes their shipping address using the address_update
callback.
The address_update
callback is activated by specifying the address_update
URL as part of the merchant_urls object when the order is created. (Note that the URL must be a valid HTTPS URL)
During the callback the order lines, the shipping options, both of them, or neither of them can be updated. The response to the POST request will be handled as following
Note: During the callback the order will be locked for changes using the regular update call. Any updates must be done by responding to the callback.
Example response:
If you provide the shipping_option_update URL as part of the merchant_urls object a POST request will be sent to that URL when the customer selects or changes shipping option.
This callback is optional to implement, even if you use the Checkout shipping selector. If no callback is provided KCO will add the shipping option to the order totals and order lines. You will then receive the selected shipping option in the selected_shipping_option
field.
The body of the POST request will contain these fields:
Example POST request:
You should update the totals and order lines based on the selected shipping option and return this information in the response body. When receiving this information the Checkout will update and show the new total.
The response should contain:
Example response body: