Shipping and delivery
A shipping profile is a set of delivery zones and their rates for some of your products. Every store has a default profile, made the first time anyone asks, so checkout offers delivery with no set-up. Products without a profile of their own ship under the default.
1. Read your rates
Section titled “1. Read your rates”GET /v1/shipping_profiles answers each profile with its zones and their rates, the default first.
curl -sS "https://api.tuppence.ai/v1/shipping_profiles" \ -H "Authorization: Bearer $TUPPENCE_SECRET_KEY"Rate kind | Priced by |
|---|---|
flat | One amount |
weight_band | bands of grams, each with its amount |
price_band | bands of the basket’s goods in minor units |
carrier_calculated | The carrier’s quote at checkout, plus your markup. fallback_amount shows if the carrier doesn’t answer in time |
local_delivery, collection | From one of your locations (location) |
free_over makes a rate free when the goods reach that amount.
2. Preview what a shopper sees
Section titled “2. Preview what a shopper sees”GET /v1/shipping_profiles/preview answers the checkout’s delivery options for an address: each
with its price and dates, and what is refused and why.
curl -sS "https://api.tuppence.ai/v1/shipping_profiles/preview?country=GB&postcode=LS1%205HN&weight_grams=800" \ -H "Authorization: Bearer $TUPPENCE_SECRET_KEY"| Parameter | |
|---|---|
country | Two letters: GB, US. Required |
region | A subdivision: TX, SCT |
postcode | A postcode or ZIP code |
weight_grams | The goods’ weight (500 when left out). The package is added as at checkout |
subtotal | The goods in minor units, for free_over |
3. Change a rate
Section titled “3. Change a rate”POST /v1/shipping_profiles/{id}/zones/{zone}/rates/{rate} changes a rate’s name, price, bands
or service and answers the whole profile. Shoppers see it at checkout straight away.
curl -sS -X POST "https://api.tuppence.ai/v1/shipping_profiles/shpr_123/zones/shz_123/rates/shrt_123" \ -H "Authorization: Bearer $TUPPENCE_SECRET_KEY" \ -H "Content-Type: application/json" \ -d '{"amount": 395}'Zones, new rates and packages have their own routes under /v1/shipping_profiles and
/v1/shipping_packages. GET /v1/shipping_services lists the services a rate can name.
Agents and the assistant
Section titled “Agents and the assistant”| Tool | Does |
|---|---|
get_shipping_profiles | Reads the profiles, zones and rates |
preview_delivery_options | What a shopper at an address is offered. Agents quote it; they never make up a price or a date |
update_shipping_rate | A rate’s name, price, free-over amount, fallback price or whether it’s offered. What shoppers pay is a price, so a person approves it every time, and it can be undone from your change history |