If you are building a custom fulfilment flow or headless checkout, Delivery 2.0 requires programmatic orchestration - See What is Delivery 2.0 article for more details. The required implementation flow is:
- Create shipping rate tiers in the Admin Portal.
- Retrieve rate definitions using Get Delivery 2.0 Shipping Rates API
- Detect the buyer’s cart total price or weight.
- Match the cart value against the configured rate thresholds.
- Update the Order’s Freight field using:
- Merchant - Edit Order Details API
- Admin - Edit Order Details API
| Note: Delivery 2.0 does not automatically calculate freight during API-driven checkout. Parse the rate object, compare cart total against thresholds, determine the applicable fee, and apply it explicitly via Order update API. |
Delivery 2.0 API Response Structure
The Delivery 2.0 API response typically contains several fields. The three most critical are:
- ID: GUID of the delivery method
- Description: Name of the delivery method
- Values: Array (length 1) containing rate configuration in a parsable JSON string
Example API Response
Example parsing logic (JavaScript)
var obj = JSON.parse(price_dependant.CustomFields[0].Values);
var rate = obj.Rates;
var variable = 15; // total price or weight
console.log("This item has a " + obj.CalculationType + " of " + variable + ".");
for (var i = 0; i < rate.length; i++) {
if (variable < rate[i].MaximumRange) {
console.log("Shipping Cost = $", rate[i].Cost);
break;
}
if (rate[i].MaximumRange == "") {
console.log("Shipping Cost = $", rate[i].Cost);
}
}