Skip to main content
PUT
https://www.xn--dkkango-n2a.com/api/integrations
/
orders
/
ontheway
/
{order_id}
Mark Order On The Way
curl --request PUT \
  --url https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/{order_id} \
  --header 'Access-Token: <api-key>'
{
  "status": false,
  "error": "yetkisiz erişim"
}

Overview

Updates an order status from CONFIRMED to IN_DELIVERY, indicating that the order is on its way to the customer.
This endpoint is only valid for restaurant couriers (courier_type: "restaurant"). Platform couriers are managed externally.

Path Parameters

order_id
string
required
Order’s payment_key (UUID)

Headers

Access-Token
string
required
Your API access token

Response

status
boolean
true if successful
data
string
"OK" on success

Examples

curl -X PUT https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/3e9caf87-5cb7-4c4e-adcb-fc2ec54cf24e \
  -H 'Access-Token: your-access-token'

Success Response (200)

{
  "status": true,
  "data": "OK"
}

Error Responses

{
  "status": false,
  "error": "yetkisiz erişim"
}

Status Transition

CONFIRMED (status_id: 2)

[/orders/ontheway called]

IN_DELIVERY (status_id: 16)
The order status changes to IN_DELIVERY with status_id: 16 (Restoran Kuryeye Verildi).

When to Call

1

Order Prepared

Kitchen has finished preparing the order
2

Courier Assigned

A courier has been assigned and is ready to leave
3

Courier Pickup

Courier picks up the order from restaurant
4

Call Endpoint

Call /ontheway to update status
5

Customer Notified

Customer receives notification that order is on the way

Courier Type Check

Important: Only call this for restaurant-managed deliveries!
async function markOnTheWay(order) {
  // Check courier type first
  if (order.courier_type !== 'restaurant') {
    console.log('Skipping: Not restaurant courier');
    return;
  }
  
  // Call endpoint
  await updateOrderStatus(order.payment_key, 'ontheway');
  
  // Notify courier
  notifyCourier(order);
}

Integration Examples

async function handleCourierDispatch(order, courier) {
  // 1. Assign courier in POS
  await assignCourier(order.id, courier.id);
  
  // 2. Print delivery slip
  await printDeliverySlip(order, courier);
  
  // 3. Update API
  await markOnTheWay(order.payment_key);
  
  // 4. Send SMS to courier
  await sendCourierSMS(courier.phone, order.address);
  
  console.log(`✅ Order ${order.id} dispatched to ${courier.name}`);
}

Tracking Integration

class DeliveryTracker {
  async startTracking(order, courier) {
    // 1. Mark as on the way
    await markOnTheWay(order.payment_key);
    
    // 2. Start GPS tracking
    const trackingSession = await this.gps.startSession({
      orderId: order.id,
      courierId: courier.id,
      destination: order.address
    });
    
    // 3. Send tracking link to customer
    await this.sendTrackingLink(order.customer.phone, trackingSession.url);
    
    // 4. Monitor progress
    trackingSession.on('arrived', async () => {
      // Auto-complete when arrived
      await completeOrder(order.payment_key);
    });
  }
}

Best Practices

async function safeDispatch(order) {
  // Check all items prepared
  const allReady = await checkAllItemsReady(order.id);
  if (!allReady) {
    alert('Not all items are ready!');
    return false;
  }
  
  // Check packaging complete
  const packaged = await isOrderPackaged(order.id);
  if (!packaged) {
    alert('Order not packaged!');
    return false;
  }
  
  // Dispatch
  await markOnTheWay(order.payment_key);
  return true;
}
Ensure courier is properly assigned before marking on the way.
Notify customer when order is dispatched (optional, platform may handle).
async function loggedDispatch(order) {
  const dispatchTime = new Date();
  
  await markOnTheWay(order.payment_key);
  
  await database.logDispatch({
    orderId: order.id,
    dispatchTime,
    estimatedArrival: calculateETA(order.address)
  });
}