Skip to main content
PUT
/
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>'
import requests

url = "https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/{order_id}"

headers = {"Access-Token": "<api-key>"}

response = requests.put(url, headers=headers)

print(response.text)
const options = {method: 'PUT', headers: {'Access-Token': '<api-key>'}};

fetch('https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/{order_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/{order_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Access-Token: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/{order_id}"

req, _ := http.NewRequest("PUT", url, nil)

req.Header.Add("Access-Token", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/{order_id}")
.header("Access-Token", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/{order_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Access-Token"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "status": false,
  "error": "yetkisiz erişim"
}
{
  "status": false,
  "error": "URL hatalı"
}
{
  "status": false,
  "error": "sipariş bulunamadı"
}

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'
const paymentKey = '3e9caf87-5cb7-4c4e-adcb-fc2ec54cf24e';

const response = await fetch(
  `https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/${paymentKey}`,
  {
    method: 'PUT',
    headers: {
      'Access-Token': 'your-access-token'
    }
  }
);

const data = await response.json();
// Order is now IN_DELIVERY
import requests

payment_key = '3e9caf87-5cb7-4c4e-adcb-fc2ec54cf24e'

response = requests.put(
    f'https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/{payment_key}',
    headers={'Access-Token': 'your-access-token'}
)

data = response.json()
# Order is now IN_DELIVERY
<?php
$paymentKey = '3e9caf87-5cb7-4c4e-adcb-fc2ec54cf24e';
$url = "https://www.xn--dkkango-n2a.com/api/integrations/orders/ontheway/{$paymentKey}";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Access-Token: your-access-token'
));
$response = curl_exec($ch);
curl_close($ch);
// Order is now IN_DELIVERY
?>

Success Response (200)

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

Error Responses

{
  "status": false,
  "error": "yetkisiz erişim"
}
{
  "status": false,
  "error": "URL hatalı"
}
{
  "status": false,
  "error": "sipariş bulunamadı"
}

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)
  });
}

Accept Order

Previous step: Accept order

Complete Order

Next step: Complete delivery

Order Lifecycle

Complete order flow