Complete Order
curl --request PUT \
--url https://www.xn--dkkango-n2a.com/api/integrations/orders/complete/{order_id} \
--header 'Access-Token: <api-key>'import requests
url = "https://www.xn--dkkango-n2a.com/api/integrations/orders/complete/{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/complete/{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/complete/{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/complete/{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/complete/{order_id}")
.header("Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.xn--dkkango-n2a.com/api/integrations/orders/complete/{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
Complete Order
Mark order as delivered and complete
PUT
/
orders
/
complete
/
{order_id}
Complete Order
curl --request PUT \
--url https://www.xn--dkkango-n2a.com/api/integrations/orders/complete/{order_id} \
--header 'Access-Token: <api-key>'import requests
url = "https://www.xn--dkkango-n2a.com/api/integrations/orders/complete/{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/complete/{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/complete/{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/complete/{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/complete/{order_id}")
.header("Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.xn--dkkango-n2a.com/api/integrations/orders/complete/{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
Marks an order as successfully delivered to the customer. Changes order status toCOMPLETE_WITH_PAYMENT.
All orders are marked as
COMPLETE_WITH_PAYMENT regardless of payment type (including CASH). This indicates successful delivery and payment confirmation.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/complete/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/complete/${paymentKey}`,
{
method: 'PUT',
headers: {
'Access-Token': 'your-access-token'
}
}
);
const data = await response.json();
// Order is now COMPLETE_WITH_PAYMENT
import requests
payment_key = '3e9caf87-5cb7-4c4e-adcb-fc2ec54cf24e'
response = requests.put(
f'https://www.xn--dkkango-n2a.com/api/integrations/orders/complete/{payment_key}',
headers={'Access-Token': 'your-access-token'}
)
data = response.json()
# Order is now COMPLETE_WITH_PAYMENT
<?php
$paymentKey = '3e9caf87-5cb7-4c4e-adcb-fc2ec54cf24e';
$url = "https://www.xn--dkkango-n2a.com/api/integrations/orders/complete/{$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 COMPLETE_WITH_PAYMENT
?>
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
IN_DELIVERY (status_id: 16)
↓
[/orders/complete called]
↓
COMPLETE_WITH_PAYMENT (status_id: 5)
Payment Handling
- Cash Payment
- Card Payment
- Any Payment Type
async function completeCashOrder(order) {
// 1. Courier confirms cash received
const cashReceived = await confirmCashPayment(order.total);
if (cashReceived) {
// 2. Complete order
await completeOrder(order.payment_key);
// 3. Log cash collection
await logCashCollection({
orderId: order.id,
amount: order.total,
courierId: currentCourier.id,
timestamp: new Date()
});
console.log(`✅ Cash order ${order.id} completed`);
}
}
async function completeCardOrder(order) {
// Card already processed - just confirm delivery
await completeOrder(order.payment_key);
console.log(`✅ Card order ${order.id} completed`);
}
async function completeOrder(order) {
// All payment types use same endpoint
await apiClient.put(`/orders/complete/${order.payment_key}`);
// Status: COMPLETE_WITH_PAYMENT (regardless of payment type)
await updateLocalStatus(order.id, 'complete');
}
All payment types (CASH, CREDIT_CARD, DEBIT_CARD) are marked as
COMPLETE_WITH_PAYMENT. This confirms both delivery and payment collection.When to Call
1
Courier Arrives
Courier reaches customer location
2
Deliver Order
Hand order to customer
3
Collect Payment (if cash)
If cash order, collect payment from customer
4
Confirm Completion
Courier confirms delivery in app/POS
5
Call Endpoint
System calls
/complete to finalize orderIntegration Examples
- Mobile App (Courier)
- POS System
- Automatic (GPS)
async function courierCompleteOrder(orderId, photo, signature) {
const order = await getOrder(orderId);
// 1. Upload proof of delivery
const proofUrl = await uploadDeliveryProof(photo);
const signatureUrl = await uploadSignature(signature);
// 2. Complete order
await completeOrder(order.payment_key);
// 3. Save delivery proof
await saveDeliveryProof({
orderId: order.id,
photoUrl: proofUrl,
signatureUrl: signatureUrl,
timestamp: new Date(),
location: await getCurrentLocation()
});
showSuccessMessage('Order completed!');
}
async function posCompleteOrder(order) {
// Confirm with staff
const confirmed = await confirmDialog(
`Complete order ${order.id}?`,
`Customer: ${order.customer.name}\nTotal: ₺${order.total}`
);
if (!confirmed) return;
// Complete
await completeOrder(order.payment_key);
// Update display
await removeFromActiveOrders(order.id);
await addToCompletedOrders(order.id);
// Print receipt (if needed)
if (order.payment_type === 'CASH') {
await printCourierReceipt(order);
}
}
class AutoComplete {
async monitorDelivery(order, courier) {
const tracking = await startGPSTracking(courier.id);
tracking.on('arrived', async (location) => {
// Courier arrived at destination
if (isNearAddress(location, order.address)) {
// Wait 2 minutes for handoff
await sleep(120000);
// Auto-complete
await completeOrder(order.payment_key);
console.log(`Auto-completed order ${order.id}`);
}
});
}
}
Best Practices
Verify Payment Collection
Verify Payment Collection
async function safeComplete(order) {
if (order.payment_type === 'CASH') {
// Confirm cash received
const cashConfirmed = await confirmCashReceived(order.total);
if (!cashConfirmed) {
alert('Please confirm cash payment first!');
return false;
}
}
await completeOrder(order.payment_key);
return true;
}
Record Completion Time
Record Completion Time
async function completeWithTimestamp(order) {
const completionTime = new Date();
await completeOrder(order.payment_key);
await database.logCompletion({
orderId: order.id,
completionTime,
deliveryDuration: completionTime - order.dispatchTime,
courierId: order.courierId
});
}
Customer Feedback
Customer Feedback
async function completeWithFeedback(order) {
await completeOrder(order.payment_key);
// Request customer feedback (optional)
setTimeout(() => {
sendFeedbackRequest(order.customer.phone, order.id);
}, 300000); // 5 minutes after delivery
}
Analytics Tracking
Analytics Tracking
async function completeWithAnalytics(order) {
await completeOrder(order.payment_key);
// Track metrics
analytics.track('order_completed', {
orderId: order.id,
total: order.total,
items: order.foods.length,
deliveryTime: calculateDeliveryTime(order),
courierId: order.courierId
});
}
Error Handling
async function completeOrderSafely(order) {
try {
await completeOrder(order.payment_key);
// Success
showSuccessNotification('Order completed successfully');
playSuccessSound();
} catch (error) {
if (error.status === 404) {
// Order not found
alert('Order not found. May have been canceled.');
} else if (error.status === 403) {
// Invalid order state
alert('Order cannot be completed in current state');
} else {
// Other errors
console.error('Completion failed:', error);
alert('Failed to complete order. Please try again.');
}
// Log for investigation
await logCompletionError(order.id, error);
}
}
Post-Completion
1
Order Archived
Order moves to completed/archived status
2
Courier Available
Courier becomes available for next delivery
3
Customer Notified
Customer receives delivery confirmation
4
Analytics Updated
Metrics and reports updated with completion
Related Endpoints
On The Way
Previous step: Dispatch order
Order Lifecycle
Complete order flow
Get Current Orders
Completed orders won’t appear here
⌘I