Bill customers for transport
Every delivery Alrik runs gets a cost. For your own fleet, Alrik calculates it from the tour that carried it. For an external carrier, it is what the carrier reported.
This guide shows how to turn those costs into invoice lines, or internal recharges between branches, at the end of a billing period.
What you will build
- A per-delivery cost for every order delivered in a period.
- A clear rule for whether your invoice includes the drive back after the last delivery.
- The tour behind each figure, for when a customer asks.
Before you begin, you need an API key that can read company orders. The
detailed tour breakdown usually comes with a separate reporting key, so
billing access can be granted without opening up order creation — ask
tech@alrik.com.
1. Collect the period's deliveries
List company orders for the billing period. It covers every branch in your company at once, and each order carries:
transport_cost— what the delivery cost to run- either a
tour_id(your own fleet) or acarrier(an external carrier) transport_price, if a customer price has been set in Alrik
Page through until there are no more pages. There is no limit on the date range.
Company orders contains orders that were planned. An order cancelled before it was planned never appears, so it never reaches an invoice.
2. Decide what goes on the invoice
transport_cost is the delivery itself. Each order also carries two
attributions in additional_data:
| Attribution | Already in transport_cost? |
|---|---|
empty_attribution | Yes — do not add it |
driveback_attribution | No — add it if you bill the drive back after the last dropoff |
Whether your customers pay for the drive back is a commercial decision, and customers differ. Decide once and apply it consistently:
- Bill the delivery only: invoice
transport_cost. - Bill delivery and drive-back: invoice
transport_costplusdriveback_attribution.
3. Round, and know the currency
Costs come back unrounded — 278.889 is a normal value. Round them yourself,
once, at the point you invoice.
Amounts are in the currency configured for the company and branch that owns the order. No currency code is returned, because each company and branch always works in one currency.
4. Show the breakdown when asked
When a customer questions a figure,
billable tours shows the tour behind it: driver,
vehicle, start and end times, and the orders it carried. tour_id links each
order to its tour.
Treat transport_cost as the number to invoice; the tour is the context.
Carrier deliveries
When a carrier ran the delivery, transport_cost is the total the carrier
reported, and tour_id is empty. There is no tour and no
attributions — the carrier's figure is the whole cost.
Related
- Deliver orders as a carrier — how carriers report their cost
- API reference: List company orders · List billable tours · Engagement report