PATCH https://example.com/api/v1/orders/{id}

Update Order Status

Updates order status and/or cargo tracking fields. Send at least one of: status, cargoCompany, trackingNumber (snake_case aliases are also accepted).

Valid Status Values

  • 1 — Payment awaiting
  • 2 — Preparing
  • 3 — Shipped
  • 4 — Delivered
  • 5 — Cancelled

Body Parameters

ParameterTypeRequiredDescription
statusintegerNo*New status (1–5)
cargoCompanystringNo*Carrier name
trackingNumberstringNo*Tracking number
PHP
<?php

$baseUrl = 'https://example.com/api/v1';
$apiKey  = 'YOUR_API_KEY';
$orderId = 15;

function apiRequest(string $method, string $url, string $apiKey, ?array $data = null): array
{
    $ch = curl_init();
    $headers = [
        'X-API-Key: ' . trim($apiKey),
        'Accept: application/json',
    ];
    if ($data !== null) {
        $headers[] = 'Content-Type: application/json';
    }
    curl_setopt_array($ch, [
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => $method,
        CURLOPT_HTTPHEADER => $headers,
        CURLOPT_SSL_VERIFYPEER => true,
    ]);
    if ($data !== null) {
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
    }
    $response = curl_exec($ch);
    $httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $error = curl_error($ch);
    curl_close($ch);
    $decoded = json_decode((string) $response, true);
    return [
        'http_code' => $httpCode,
        'curl_error' => $error,
        'response' => is_array($decoded) ? $decoded : $response,
    ];
}

$payload = [
    'status' => 3,
    'cargoCompany' => 'Yurtiçi Kargo',
    'trackingNumber' => 'YT123456789',
];

$result = apiRequest('PATCH', $baseUrl . '/orders/' . (int) $orderId, $apiKey, $payload);
print_r($result);
cURL
curl -s -X PATCH \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "status": 3,
    "cargoCompany": "Yurtiçi Kargo",
    "trackingNumber": "YT123456789"
  }' \
  "https://example.com/api/v1/orders/15"
Sample Response (JSON)
{
  "success": true,
  "message": "Sipariş güncellendi",
  "content": {
    "id": 15,
    "orderNumber": "FS-20260617-0015",
    "statusCode": 3,
    "status": "Shipped",
    "statusLabel": "Kargoda",
    "cargoCompany": "Yurtiçi Kargo",
    "trackingNumber": "YT123456789"
  }
}