# Đặt mua một dịch vụ

`POST /v1/order/@product_id` · quyền `orders:write`

Tạo đơn cho một gói theo `product_id`, `cycle`, `domain` (dạng cũ; nên dùng POST /v1/order). Cần cả `orders:write` và `billing:write`: thiếu một trong hai trả 403 `insufficient_scope`.

## HTTP request

| Mục | Giá trị |
| --- | --- |
| URL | `https://api.tino.vn/v1/order/@product_id` |
| Method | `POST` |
| Quyền (scope) | `orders:write` |
| Header | `Authorization: Bearer <token>` |
| Content-Type | `application/json` |
| Token gọi được | token ứng dụng (`tinoat_`), token API cá nhân (`tinopat_`) |

## Tham số

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `product_id` | đường dẫn | integer | có | ID sản phẩm (gói dịch vụ, chứng chỉ) |
| `domain` | body | string | không | Domain name, ie. example.com, may be optional |
| `cycle` | body | string | không | Billing period symbol |
| `pay_method` | body | integer | không | Payment method ID |
| `custom` | body | array | không | Additional options data available for sop products |
| `promocode` | body | string | không | Promotion code |
| `aff_id` | body | integer | không | Affiliate ID |

## Example request

```bash
curl -X POST "https://api.tino.vn/v1/order/26" \
  -H "Authorization: Bearer $TINO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "<domain>",
  "cycle": "<cycle>",
  "pay_method": "<pay_method>",
  "custom": "<custom>",
  "promocode": "<promocode>",
  "aff_id": 55
}'
```

`$TINO_TOKEN` là token có quyền `orders:write`. Tham số đường dẫn trong ví dụ là giá trị mẫu.

SDK ([SDK & Ví dụ](/docs/sdk)): Python `client.cart.order_product(product_id, domain=...)`, Node.js `await client.cart.orderProduct(productId, { domain: ... });`, PHP `$client->cart->orderProduct($productId, ['domain' => ...]);`.

## Example response

Chưa có mẫu thật: route thay đổi dữ liệu thật hoặc tài khoản thử không có dữ liệu cho route này. Câu trả lời là một đối tượng JSON; lỗi theo dạng chung ở [Gọi API Tino](/docs/api#loi).
