ShippingService class (accessed via client.shipping) handles delivery fee calculations, zone checking, and shipping configuration retrieval for your commerce storefront.
Methods
getShippingZones
Retrieve all active delivery zones and distance-based pricing tiers. This is useful for displaying delivery availability or potential costs to users early in the shopping journey.
priority:
calculateShipping
Calculate the exact delivery fee for a customer based on their location and order total.
order_total is the order subtotal in the store’s currency (e.g. 50 = $50.00), not a
minor-unit (cents) value. It is used only to decide whether the order reaches a tier’s or zone’s
free-delivery threshold.Live carrier rates (multi-carrier)
When the store has multi-carrier shipping connected, pass a destinationaddress_to and a
parcel to calculateShipping to ALSO get live carrier rates alongside the zone/tier fee. The
response gains a rates[] array (real quotes from USPS, UPS, FedEx, DHL…) and rate_source becomes
shippo. If the store has connected its own custom carrier (a Custom Extension shipping provider),
its rates are appended too and rate_source becomes custom. When neither is connected, rates[] is
simply absent and the zone/tier fee applies as before — the manual rates always work.
rates[] to the shopper, let them pick, and carry the chosen rate_id into checkout (pass it as
shippo_rate_id on createOrder so the order’s shipping is validated against that real quote).
Buying a shipping label is done by the merchant from their admin — it charges the merchant’s carrier
account, marks the order shipped, and emits
order.shipped — so there is no SDK method for it. From a
storefront you quote rates (calculateShipping) and track parcels (trackShipment).trackShipment
Returns live tracking status for a parcel by carrier + tracking number — use this when you want to
render the status timeline inside your own UI.
How Fees Are Calculated
Tybrite uses a priority-based logic to determine the shipping fee:- Custom Zones: If the location falls within a defined polygon, the specific zone fee is applied.
- Distance Tiers: If the customer is outside all zones, the system calculates the distance from your store and matches it to a pricing tier (e.g., 5-10km).
- Free Delivery: If the
order_totalexceeds the threshold for that zone/tier, the fee is waived.
Input Flexibility:
calculateShipping accepts either { latitude, longitude, order_total } or { place_name, country_code?, order_total }. When you supply a place_name, Galactic Core resolves it to coordinates for you. The response shape is identical regardless of input mode: { fee, zone_name, tier_name, distance_meters, is_free, reason, applied_rule, coordinates }.Response Codes
Both methods accept publishable and secret keys.calculateShipping uses POST purely to carry a structured request body — it is read-only.
getShippingZones (GET /v1/shipping/zones)
This method has no
400 because it takes no input to validate.

