# Хүргэлтийн явц шинэчлэх

> Өөрөө хүргэдэг захиалгын курьер эсвэл мастерын байршлыг илгээнэ.

Эх: https://docs.tappay.mn/mn/reference/orders/put-tracking/

Өөрөө хүргэдэг захиалгын курьер эсвэл мастер, байршил, ирэх цагийг илгээнэ. Хэрэглэгч утасны дугаарыг далдлагдсан байдлаар харна.

`PUT /api/v1/commerce/orders/{order_id}/tracking` Хувилбар 2026-09-27

### Нэвтрэлт

Secret key (Bearer)

### Header

| Нэр | Төрөл | Заавал | Утга | Тайлбар |
| - | - | - | - | - |
| `TapPay-Version` | string | үгүй | | |
| `TapPay-Timestamp` | string | үгүй | | |
| `TapPay-Nonce` | string | үгүй | | |
| `TapPay-Signature` | string | үгүй | | |

### Замын параметр

| Нэр | Төрөл | Заавал | Утга | Тайлбар |
| - | - | - | - | - |
| `order_id` | string (uuid) | тийм | | |

### Хүсэлтийн бие

| Нэр | Төрөл | Заавал | Утга | Тайлбар |
| - | - | - | - | - |
| `agent` | object | үгүй | | |
| `agent.name` | string | тийм | | |
| `agent.phone` | string | тийм | | |
| `agent.photo_url` | string (uri) | үгүй | | |
| `agent.provider_label` | string | үгүй | | |
| `location` | object | үгүй | | |
| `location.lat` | number | тийм | | |
| `location.lng` | number | тийм | | |
| `eta_at` | string (date-time) | үгүй | | |
| `tracking_url` | string (uri) | үгүй | | |

### Хариу 200

| Нэр | Төрөл | Заавал | Утга | Тайлбар |
| - | - | - | - | - |
| `success` | boolean | тийм | `true` | |
| `data` | object | тийм | | |
| `data.order_id` | string (uuid) | тийм | | |
| `data.order_no` | string | тийм | | |
| `data.channel` | string | тийм | | |
| `data.status` | string | тийм | `CREATED`, `ACCEPTED`, `AWAITING_PAYMENT`, `CONFIRMED`, `IN_PROGRESS`, `READY`, `COMPLETED`, `CANCELLED`, `REJECTED`, `EXPIRED`, `FAILED` | |
| `data.version` | integer | тийм | | |
| `data.merchant` | object | тийм | | |
| `data.merchant.merchant_code` | string | тийм | | |
| `data.merchant.name` | string | тийм | | |
| `data.location_id` | string (uuid) | тийм | | |
| `data.fulfillment` | object | тийм | | |
| `data.fulfillment.mode` | string | тийм | | |
| `data.fulfillment.label` | string | тийм | | |
| `data.fulfillment.address` | object \| null | тийм | | |
| `data.fulfillment.address.label` | string \| null | тийм | | |
| `data.fulfillment.address.text` | string | тийм | | |
| `data.fulfillment.address.entrance` | string \| null | үгүй | | |
| `data.fulfillment.address.floor` | string \| null | үгүй | | |
| `data.fulfillment.address.door` | string \| null | үгүй | | |
| `data.fulfillment.address.note` | string \| null | үгүй | | |
| `data.fulfillment.address.location` | object \| null | тийм | | |
| `data.fulfillment.address.location.lat` | number | тийм | | |
| `data.fulfillment.address.location.lng` | number | тийм | | |
| `data.fulfillment.address.district` | string \| null | үгүй | | |
| `data.fulfillment.address.khoroo` | string \| null | үгүй | | |
| `data.fulfillment.scheduled_at` | string \| null | тийм | | |
| `data.fulfillment.ends_at` | string \| null | тийм | | |
| `data.lines` | array\<object> | тийм | | |
| `data.lines[].line_id` | string | тийм | | |
| `data.lines[].offering_id` | string | тийм | | |
| `data.lines[].name` | string | тийм | | |
| `data.lines[].quantity` | integer | тийм | | |
| `data.lines[].variant_id` | string \| null | тийм | | |
| `data.lines[].option_ids` | array\<string> | тийм | | |
| `data.lines[].inputs` | object | тийм | | |
| `data.lines[].amount` | number | тийм | | |
| `data.lines[].status` | string | тийм | | |
| `data.lines[].final_amount` | number \| null | тийм | | |
| `data.breakup` | array\<object> | тийм | | |
| `data.breakup[].kind` | string | тийм | | |
| `data.breakup[].label` | string | тийм | | |
| `data.breakup[].amount` | number | тийм | | |
| `data.breakup[].ref` | string \| null | үгүй | | |
| `data.total` | number | тийм | | |
| `data.fees` | array\<object> | тийм | | |
| `data.fees[].kind` | string | тийм | | |
| `data.fees[].label` | string | тийм | | |
| `data.fees[].amount` | number | тийм | | |
| `data.fees[].estimated` | boolean | тийм | | |
| `data.payable_total` | number | тийм | | |
| `data.authorization_type` | string | тийм | | |
| `data.authorization_amount` | number \| null | тийм | | |
| `data.accepted_total` | number \| null | тийм | | |
| `data.final_amount` | number \| null | тийм | | |
| `data.stage` | object \| null | тийм | | |
| `data.stage.code` | string | тийм | | |
| `data.stage.label` | string | тийм | | |
| `data.stage.description` | string \| null | үгүй | | |
| `data.timeline` | array\<object> | тийм | | |
| `data.timeline[].at` | string | тийм | | |
| `data.timeline[].label` | string | тийм | | |
| `data.timeline[].status` | string \| null | үгүй | | |
| `data.eta_at` | string \| null | тийм | | |
| `data.tracking` | object \| null | тийм | | |
| `data.tracking.agent` | object \| null | тийм | | |
| `data.tracking.agent.name` | string | тийм | | |
| `data.tracking.agent.phone_masked` | string \| null | тийм | | |
| `data.tracking.agent.photo_url` | string \| null | тийм | | |
| `data.tracking.agent.provider_label` | string \| null | тийм | | |
| `data.tracking.location` | object \| null | тийм | | |
| `data.tracking.location.lat` | number | тийм | | |
| `data.tracking.location.lng` | number | тийм | | |
| `data.tracking.location.at` | string | тийм | | |
| `data.tracking.eta_at` | string \| null | тийм | | |
| `data.tracking.tracking_url` | string \| null | тийм | | |
| `data.tracking.static_map_url` | string \| null | тийм | | |
| `data.artifacts` | array\<object> | тийм | | |
| `data.artifacts[].artifact_id` | string | тийм | | |
| `data.artifacts[].kind` | string | тийм | | |
| `data.artifacts[].label` | string | тийм | | |
| `data.artifacts[].value` | string \| null | үгүй | | |
| `data.artifacts[].url` | string \| null | үгүй | | |
| `data.artifacts[].valid_from` | string \| null | үгүй | | |
| `data.artifacts[].valid_to` | string \| null | үгүй | | |
| `data.artifacts[].fallback_url` | string | тийм | | |
| `data.actions` | array\<object> | тийм | | |
| `data.actions[].kind` | string | тийм | | |
| `data.actions[].allowed` | boolean | тийм | | |
| `data.actions[].deadline` | string | үгүй | | |
| `data.actions[].label` | string | тийм | | |
| `data.actions[].url` | string | үгүй | | |
| `data.next_action` | object \| null | тийм | | |
| `data.next_action.type` | string | тийм | | |
| `data.next_action.intent_id` | string | үгүй | | |
| `data.next_action.diff` | object | үгүй | | |
| `data.next_action.diff.lines` | array\<object> | тийм | | |
| `data.next_action.diff.lines[].offering_id` | string | тийм | | |
| `data.next_action.diff.lines[].before` | object \| null | тийм | | |
| `data.next_action.diff.lines[].before.quantity` | integer | тийм | | |
| `data.next_action.diff.lines[].before.amount` | number | тийм | | |
| `data.next_action.diff.lines[].after` | object \| null | тийм | | |
| `data.next_action.diff.lines[].after.quantity` | integer | тийм | | |
| `data.next_action.diff.lines[].after.amount` | number | тийм | | |
| `data.next_action.diff.total_before` | number | тийм | | |
| `data.next_action.diff.total_after` | number | тийм | | |
| `data.next_action.diff.schedule` | object | үгүй | | |
| `data.next_action.diff.schedule.before` | object | тийм | | |
| `data.next_action.diff.schedule.before.scheduled_at` | string \| null | тийм | | |
| `data.next_action.diff.schedule.before.ends_at` | string \| null | үгүй | | |
| `data.next_action.diff.schedule.after` | object | тийм | | |
| `data.next_action.diff.schedule.after.scheduled_at` | string \| null | тийм | | |
| `data.next_action.diff.schedule.after.ends_at` | string \| null | үгүй | | |
| `data.next_action.url` | string | үгүй | | |
| `data.next_action.until` | string | үгүй | | |
| `data.web_url` | string | тийм | | |
| `data.payment_id` | string \| null | тийм | | |
| `data.cancelled_by` | string \| null | тийм | | |
| `data.reason_code` | string \| null | тийм | | |
| `data.created_at` | string | тийм | | |
| `data.updated_at` | string | тийм | | |
| `data.promotions` | array\<object> | үгүй | | |
| `data.promotions[].promotion_id` | string (uuid) | тийм | | |
| `data.promotions[].kind` | string | тийм | | |
| `data.promotions[].amount` | number | тийм | | |
| `data.customer` | object | тийм | | |
| `data.customer.contact_name` | string \| null | тийм | | |
| `data.customer.contact_phone` | string \| null | тийм | | |
| `data.note` | string \| null | тийм | | |
| `data.accept_due_at` | string \| null | тийм | | |
| `data.pending_reschedule` | object \| null | тийм | | |
| `data.pending_reschedule.scheduled_at` | string | тийм | | |
| `data.pending_reschedule.ends_at` | string \| null | тийм | | |
| `data.handler_system` | string | тийм | | |
| `data.payment_due_at` | string \| null | тийм | | |
| `data.source` | object | тийм | | |
| `data.source.channel` | string | тийм | | |
| `data.source.partner_name` | string \| null | тийм | | |
| `data.source.sticker` | object \| null | тийм | | |
| `data.source.sticker.name` | string \| null | тийм | | |

### Алдаа

| Код | Status | Мессеж |
| - | - | - |
| [`AUTH-001`](https://docs.tappay.mn/mn/errors.md#AUTH-001) | 401 | API key байхгүй, буруу эсвэл хүчингүй болсон байна. |
| [`EVT-206`](https://docs.tappay.mn/mn/errors.md#EVT-206) | 401 | Production key sandbox-д хүлээн авахгүй. Sandbox key (sk_test\_/pk_test\_) ашиглана уу. |
| [`EVT-207`](https://docs.tappay.mn/mn/errors.md#EVT-207) | 401 | Sandbox key production-д хүлээн авахгүй. Production key (sk_live\_/pk_live\_) ашиглана уу. |
| [`AUTH-018`](https://docs.tappay.mn/mn/errors.md#AUTH-018) | 403 | Хүсэлт түлхүүрийн зөвшөөрөгдсөн IP жагсаалтад ороогүй хаягаас ирсэн. |
| [`AUTH-058`](https://docs.tappay.mn/mn/errors.md#AUTH-058) | 403 | API key-д энэ үйлдэлд шаардлагатай scope байхгүй байна. |
| [`SIG-002`](https://docs.tappay.mn/mn/errors.md#SIG-002) | 401 | Хүсэлтийн цагийн тэмдэг зөвшөөрөгдсөн хугацааны гадна байна. |
| [`SIG-003`](https://docs.tappay.mn/mn/errors.md#SIG-003) | 401 | Хүсэлтийн гарын үсэг байхгүй эсвэл таарахгүй байна. |
| [`SIG-005`](https://docs.tappay.mn/mn/errors.md#SIG-005) | 409 | Энэ хүсэлтийн nonce өмнө нь ашиглагдсан байна. |
| [`VAL-014`](https://docs.tappay.mn/mn/errors.md#VAL-014) | 400 | TapPay-Version header нь мэдэгдэх API хувилбар биш байна. |
| [`BIZ-004`](https://docs.tappay.mn/mn/errors.md#BIZ-004) | 403 | Terminal идэвхгүй байна. |
| [`BIZ-005`](https://docs.tappay.mn/mn/errors.md#BIZ-005) | 403 | Мерчантын данс энэ хүсэлтийг зөвшөөрөх төлөвт байхгүй байна. |
| [`ORD-001`](https://docs.tappay.mn/mn/errors.md#ORD-001) | 409 | Захиалгын төлөв энэ үйлдлийг зөвшөөрөхгүй. |
| [`ORD-010`](https://docs.tappay.mn/mn/errors.md#ORD-010) | 403 | Энэ захиалгыг өөр систем хүлээн авдаг. |
| [`ORD-014`](https://docs.tappay.mn/mn/errors.md#ORD-014) | 404 | Захиалга олдсонгүй. |
| [`DLV-002`](https://docs.tappay.mn/mn/errors.md#DLV-002) | 409 | Хүргэлтийн одоогийн төлөвт энэ үйлдэл боломжгүй. |
| [`DLV-003`](https://docs.tappay.mn/mn/errors.md#DLV-003) | 409 | Хүргэлтийн явцыг dispatcher удирдана. |
| [`DLV-004`](https://docs.tappay.mn/mn/errors.md#DLV-004) | 404 | Хүргэлт олдсонгүй. |

Playground-д туршиж үзэх: https://docs.tappay.mn/mn/reference/orders/put-tracking/

```bash title="curl"
curl -sS -X PUT "https://api.tappay.mn/api/v1/commerce/orders/ORDER_ID/tracking" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Content-Type: application/json" \
  -d '{"agent":{"name":"Courier Dorj","phone":"+97699000000"},"location":{"lat":47.9195,"lng":106.925},"eta_at":"2026-10-03T08:50:00.000Z"}'
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const result = await tappay.commerce.putTracking({
  order_id: 'ORDER_ID',
  body: {
    agent: {
      name: 'Courier Dorj',
      phone: '+97699000000',
    },
    location: {
      lat: 47.9195,
      lng: 106.925,
    },
    eta_at: '2026-10-03T08:50:00.000Z',
  },
});
console.log(JSON.stringify(result));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$result = $tappay->commerce->putTracking([
    'order_id' => 'ORDER_ID',
    'body' => [
        'agent' => [
            'name' => 'Courier Dorj',
            'phone' => '+97699000000',
        ],
        'location' => [
            'lat' => 47.9195,
            'lng' => 106.925,
        ],
        'eta_at' => '2026-10-03T08:50:00.000Z',
    ],
]);
echo json_encode($result);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
result = client.commerce.put_tracking({
    "order_id": "ORDER_ID",
    "body": {
        "agent": {
            "name": "Courier Dorj",
            "phone": "+97699000000",
        },
        "location": {
            "lat": 47.9195,
            "lng": 106.925,
        },
        "eta_at": "2026-10-03T08:50:00.000Z",
    },
})
print(json.dumps(result))
```

```json title="Response"
{
  "success": true,
  "data": {
    "order_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f02",
    "order_no": "A-1001",
    "channel": "WALLET",
    "status": "IN_PROGRESS",
    "version": 6,
    "merchant": {
      "merchant_code": "M-SANDBOX-01",
      "name": "Sandbox Cafe"
    },
    "location_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f01",
    "fulfillment": {
      "mode": "DELIVERY",
      "label": "Delivery",
      "address": {
        "label": "Home",
        "text": "Peace Avenue 10, apartment 5",
        "entrance": null,
        "floor": null,
        "door": null,
        "note": null,
        "location": {
          "lat": 47.9201,
          "lng": 106.9312
        },
        "district": null,
        "khoroo": null
      },
      "scheduled_at": null,
      "ends_at": null
    },
    "lines": [
      {
        "line_id": "l1",
        "offering_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f03",
        "name": "Latte (M)",
        "quantity": 2,
        "variant_id": null,
        "option_ids": [],
        "inputs": {},
        "amount": 18000,
        "status": "ACTIVE",
        "final_amount": null
      }
    ],
    "breakup": [
      {
        "kind": "ITEM",
        "label": "Latte (M) x 2",
        "amount": 18000,
        "ref": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f03"
      }
    ],
    "total": 18000,
    "fees": [],
    "payable_total": 18000,
    "authorization_type": "FINAL",
    "authorization_amount": null,
    "accepted_total": 18000,
    "final_amount": null,
    "stage": null,
    "timeline": [
      {
        "at": "2026-10-03T08:15:00.000Z",
        "label": "Order created",
        "status": "CREATED"
      },
      {
        "at": "2026-10-03T08:20:00.000Z",
        "label": "Order accepted",
        "status": "ACCEPTED"
      },
      {
        "at": "2026-10-03T08:20:00.000Z",
        "label": "Paid",
        "status": "CONFIRMED"
      }
    ],
    "eta_at": "2026-10-03T08:50:00.000Z",
    "tracking": {
      "agent": {
        "name": "Courier Dorj",
        "phone_masked": "+976 99** **00",
        "photo_url": null,
        "provider_label": null
      },
      "location": {
        "lat": 47.9195,
        "lng": 106.925,
        "at": "2026-10-03T08:35:00.000Z"
      },
      "eta_at": "2026-10-03T08:50:00.000Z",
      "tracking_url": "https://example.com/track/A-1001",
      "static_map_url": null
    },
    "artifacts": [],
    "actions": [],
    "next_action": null,
    "web_url": "https://pay.tappay.mn/o/ord_7f3k2m9q",
    "payment_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f04",
    "cancelled_by": null,
    "reason_code": null,
    "created_at": "2026-10-03T08:15:00.000Z",
    "updated_at": "2026-10-03T08:35:00.000Z",
    "promotions": [],
    "customer": {
      "contact_name": "Bat",
      "contact_phone": "+97699000000"
    },
    "note": null,
    "accept_due_at": null,
    "pending_reschedule": null,
    "handler_system": "MERCHANT_SYSTEM",
    "payment_due_at": null,
    "source": {
      "channel": "WALLET",
      "partner_name": "Sandbox Bank",
      "sticker": null
    }
  }
}
```

Бүтэн урсгалыг [захиалгын гарын авлагаас](https://docs.tappay.mn/mn/guides/orders.md) үзнэ үү.
