Acme Corp/

Calculate Shipping

Calculate Shipping

Code tool configuration and testing

CodeEnabled
Settings
Executions:1,087
Avg Latency:18ms
Success Rate:99.2%
1async function execute({ weight, destination, priority }) {
2 const baseRate = weight * 0.85;
3 const zones = {
4 domestic: 1.0,
5 canada: 1.4,
6 international: 2.8,
7 };
8 
9 const zoneMultiplier = zones[destination] || zones.international;
10 const priorityFee = priority === 'express' ? 12.99 : 0;
11 
12 const cost = (baseRate * zoneMultiplier) + priorityFee;
13 
14 return {
15 cost: Math.round(cost * 100) / 100,
16 currency: 'USD',
17 estimatedDays: priority === 'express' ? 2 : 5,
18 carrier: 'FastShip',
19 };
20}

Parameters

NameTypeRequiredDescription
weightnumberYesPackage weight in lbs
destinationstringYesShipping zone
prioritystringNo"standard" or "express"

Test Tool

Run this tool with sample inputs

3.5
domestic
express
Run Test
Success
23ms
Output
{
"cost": 15.97,
"currency": "USD",
"estimatedDays": 2,
"carrier": "FastShip"
}
2 seconds ago