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ı"
}
Orders
Mark Order On The Way
Update order status to out for delivery
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 fromCONFIRMED 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
string
required
Order’s
payment_key (UUID)Headers
string
required
Your API access token
Response
boolean
true if successfulstring
"OK" on successExamples
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 status5
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
- Manual Dispatch
- Automatic Dispatch
- QR Code Scan
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}`);
}
async function autoDispatch() {
// Get prepared orders
const preparedOrders = await getOrdersByStatus('CONFIRMED');
for (const order of preparedOrders) {
if (order.courier_type !== 'restaurant') continue;
// Find available courier
const courier = await findAvailableCourier();
if (courier) {
await assignCourier(order.id, courier.id);
await markOnTheWay(order.payment_key);
console.log(`Auto-dispatched order ${order.id}`);
}
}
}
// Run every 2 minutes
setInterval(autoDispatch, 120000);
async function handleQRScan(qrCode) {
// Parse order from QR code
const order = await parseOrderQR(qrCode);
// Verify order status
if (order.status !== 'CONFIRMED') {
alert('Order not ready for delivery');
return;
}
// Mark on the way
await markOnTheWay(order.payment_key);
// Courier confirmation
showSuccessMessage('Order marked for delivery');
}
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
Verify Order Ready
Verify Order Ready
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;
}
Courier Assignment
Courier Assignment
Ensure courier is properly assigned before marking on the way.
Customer Communication
Customer Communication
Notify customer when order is dispatched (optional, platform may handle).
Log Dispatch Time
Log Dispatch Time
async function loggedDispatch(order) {
const dispatchTime = new Date();
await markOnTheWay(order.payment_key);
await database.logDispatch({
orderId: order.id,
dispatchTime,
estimatedArrival: calculateETA(order.address)
});
}
Related Endpoints
Accept Order
Previous step: Accept order
Complete Order
Next step: Complete delivery
Order Lifecycle
Complete order flow
⌘I