Skip to content

How an ordering platform hands off delivery

One restaurant marketplace takes the food order at checkout, then sends FIRST Delivery the restaurant pickup and customer drop-off details. FIRST Delivery hands the delivery off to an outside courier. After delivery, the marketplace’s team uses FIRST Delivery to manage refund requests and get reports for finance.

The marketplace is a real customer. The order below is an example of how to build that handoff with the public API, not a description of the customer’s implementation.

Send the delivery from the right restaurant

Section titled “Send the delivery from the right restaurant”

A diner orders dinner for delivery from the Oak Street location. Your platform has already taken the order. To get it picked up, your server sends POST /v3/orders with the pickup location, drop-off details, and requested timing. Use the Oak Street location’s merchant_id and your checkout order number as external_id. Send the request with an orders:write key for the operator that owns that merchant.

If you resell delivery to restaurant partners, FIRST Delivery sets up one operator per partner and country in your organization. The Oak Street location is a merchant under its partner’s operator. Store that mapping when you onboard the location so that checkout can look up the merchant ID and the right operator’s credentials.

Send the order from one system. If the restaurant’s POS already sends this order to FIRST Delivery, checkout should not create it again. Save the returned order.id and _request_id when present. If the create request times out, look up your external_id before trying again. See Create an order for the request and response.

In this example, the restaurant uses a delivery partner. Checkout doesn’t need to choose one: FIRST Delivery uses the configured dispatch strategy to decide which providers to try. If this restaurant uses its own drivers instead, their assignment is managed in Dispatch, not by the Create Order routing fields.

Use auto_route.success: true to tell your team a provider accepted the delivery. If no provider accepted, the order can still exist in FIRST Delivery. Flag the existing order for your dispatch team instead of creating another one. See Quotes and routing for the response fields and how to request a quote if your checkout needs one.

Build the tracking link from order.id and put it on the confirmation page so the diner can check progress right away. The order response doesn’t include the link, but later webhook events carry it as trackerLink. It stays the same if the driver changes.

For status inside your own platform, register a webhook destination on each operator. Use orderId to find the delivery you saved and status_v3 to update its status. An event can arrive twice or after a newer event. Make your updates safe to repeat and fetch GET /v3/orders/:id when you need to confirm the current state.

Use the sandbox to create a test order and check that your webhook receiver can process the same event twice without duplicating an update. Before sending a production test, confirm that ordering is enabled for that operator. Agree on a test with the restaurant for each location you turn on: a production order can send a real courier.