# ถามผลการชำระเงินล่าสุดของคำสั่งซื้อ

Source: https://checkslip.com/docs/sync-order

POST `https://api.checkslip.com/api/billing/orders/{order_id}/sync`

ใช้ API key

ตรวจผลการชำระเงินทันที แทนการรอผลที่จะแจ้งมาเอง ถ้าชำระแล้วเครดิตเข้าบัญชีตอนนั้น ถ้าปิดหน้าชำระเงินแล้วแต่เงินยังไม่เข้า คำสั่งซื้อจะอยู่ในสถานะกำลังยืนยันการชำระเงิน ถามซ้ำในไม่กี่วินาทีได้ผลเดิม ใช้ API key ที่มีสิทธิ์ billing:read

## Parameters

| ฟิลด์ | ส่งทาง | ชนิด | จำเป็น |
| --- | --- | --- | --- |
| `order_id` | path | `string (uuid)` | ใช่ |

## Responses

### 200 `application/json`

| ฟิลด์ | ชนิด | จำเป็น |
| --- | --- | --- |
| `id` | `string (uuid)` | ใช่ |
| `status` | `PENDING \| PAID \| CANCELLED \| FLAGGED` | ใช่ |
| `package_code` | `string` | ใช่ |
| `package_name_th` | `string` | ใช่ |
| `credits` | `integer` | ใช่ |
| `amount` | `Money` | ใช่ |
| `amount.satang` | `integer` | ใช่ |
| `amount.currency` | `string = THB` | ใช่ |
| `payment_method` | `CARD \| PROMPTPAY \| null` | ไม่ |
| `receipt_id` | `string (uuid) \| null` | ไม่ |
| `created_at` | `string (date-time)` | ใช่ |
| `paid_at` | `string (date-time) \| null` | ไม่ |
| `cancelled_at` | `string (date-time) \| null` | ไม่ |
| `confirming` | `boolean` | ไม่ |
| `review_reason` | `string \| null` | ไม่ |

### Error ที่อาจได้

401 403 404 500 503

error ในรูป Problem Details ดูรหัสทั้งหมดที่ [รหัสข้อผิดพลาด](https://checkslip.com/docs/errors)

**cURL**

```bash
curl -X POST https://api.checkslip.com/api/billing/orders/0b6c2f5e-8a41-4d1e-9c3a-5f7e2d18a6b4/sync \
  -H "Authorization: Bearer $CHECKSLIP_API_KEY"
```

**Node.js**

```javascript
const res = await fetch("https://api.checkslip.com/api/billing/orders/0b6c2f5e-8a41-4d1e-9c3a-5f7e2d18a6b4/sync", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CHECKSLIP_API_KEY}`,
  },
});
const data = await res.json();
```

**Python**

```python
import os

import requests

res = requests.post(
    "https://api.checkslip.com/api/billing/orders/0b6c2f5e-8a41-4d1e-9c3a-5f7e2d18a6b4/sync",
    headers={
        "Authorization": f"Bearer {os.environ['CHECKSLIP_API_KEY']}",
    },
)
data = res.json()
```

```json
{
  "id": "0b6c2f5e-8a41-4d1e-9c3a-5f7e2d18a6b4",
  "status": "PENDING",
  "package_code": "string",
  "package_name_th": "string",
  "credits": 1,
  "amount": {
    "satang": 5000,
    "currency": "THB"
  },
  "payment_method": "CARD",
  "receipt_id": "0b6c2f5e-8a41-4d1e-9c3a-5f7e2d18a6b4",
  "created_at": "2026-11-05T09:30:00+07:00",
  "paid_at": "2026-11-05T09:30:00+07:00",
  "cancelled_at": "2026-11-05T09:30:00+07:00",
  "confirming": true,
  "review_reason": "string"
}
```
