Who this is for: shops that deliver with their own drivers or a local courier on Track That Ride, and the developer who looks after the store. You need somewhere to run a little server code: a serverless function, a small Node.js app or your existing backend.
What will the finished flow look like?
- A customer’s order reaches the status you choose, for example “Processing” in WooCommerce or “paid and ready to fulfil” in Shopify.
- The store calls your endpoint (a store webhook).
- Your endpoint creates a Track That Ride delivery with
POST /api/v1/rides, using the order’s address and your shop as the pickup. - Your endpoint writes the tracking link back to the order, so it appears in the order page and emails.
- A driver delivers it with proof; Track That Ride sends
delivery.completedto your endpoint. - Your endpoint marks the order as completed in the store.
How do I create a delivery from an order?
Map the order to the six required fields and send the order number as order_id so you can match them later:
// Called by your store webhook handler with the order it received.
async function createDeliveryForOrder(order) {
const res = await fetch('https://trackthatride.com/api/v1/rides', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.TTR_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
customer_name: order.customerName,
phone_number: order.phone,
email: order.email, // Track That Ride emails the link when this is present
address: order.shippingAddress, // one line, e.g. "10 Example Street, Leeds LS1 1AA"
pickup_address: process.env.SHOP_ADDRESS,
pickup_contact_name: 'Shop counter',
pickup_phone: process.env.SHOP_PHONE,
estimated_pickup_time: new Date(Date.now() + 60 * 60 * 1000).toISOString(),
order_id: String(order.number),
notes: order.deliveryNote ?? undefined,
}),
});
const ride = await res.json();
if (!res.ok) throw new Error(`${res.status} ${ride.code ?? ride.error}`);
return { rideId: ride.id, trackingUrl: `https://trackthatride.com/track/${ride.public_tracking_token}` };
}
Respond to the store’s webhook quickly and do this work afterwards; both platforms retry webhooks that time out, so store the
order_id to rideId mapping and skip orders you have already handled.
How do I show the tracking link to the customer?
If the order has an email address, Track That Ride emails the customer the link when the delivery is created. To show it in your store
as well, write trackingUrl back to the order with the platform’s own API:
- WooCommerce: add a customer-visible order note, or store it in order meta and print it in your order emails, using the WooCommerce REST API.
- Shopify: add the URL as the tracking link on the order’s fulfilment with the Admin API, so it appears in the shipping confirmation.
Check the current platform documentation for the exact calls; both change their APIs from time to time.
How do I close the order when it is delivered?
Register a Track That Ride webhook for delivery.completed and delivery.failed, verify its signature (see
webhooks or the Node.js quickstart), find the order by
ride_id, then:
- on
delivery.completed, mark the order completed or fulfilled; the payload includes proof-of-delivery links valid for 24 hours if you want to copy the photos into the order; - on
delivery.failed, flag the order for your team;data.reasonsays why, anddata.cancelledis true for cancellations.
What are the limits of this approach?
- It is your code, not a plugin: you maintain it when the store platform changes.
- Each order becomes one delivery from your shop to the customer. Split shipments need one delivery each.
- Track That Ride does not plan multi-drop routes; your driver works through deliveries in the order you assign them.
- Billing counts each delivery started, so orders you cancel before the driver sets off are not charged.