# ดูแพ็กเครดิตที่เปิดขาย

Source: https://checkslip.com/docs/list-packages

GET `https://api.checkslip.com/api/billing/packages`

ใช้ API key

แสดงแพ็กเครดิตทั้งหมดพร้อมราคา จำนวนเครดิต และอายุการใช้งาน เรียกได้โดยไม่ต้องเข้าสู่ระบบ 1 เครดิตใช้ตรวจสอบรายการโอนได้ 1 ครั้ง เครดิตทุกแพ็กรวมเป็นยอดเดียวในบัญชี และมีอายุ 1 ปีนับจากวันซื้อล่าสุด

## Responses

### 200 `application/json`

| ฟิลด์ | ชนิด | จำเป็น |
| --- | --- | --- |
| `checkout_open` | `boolean` | ใช่ |
| `prices_include_vat` | `boolean` | ใช่ |
| `items` | `Package[]` | ใช่ |
| `items[].code` | `string` | ใช่ |
| `items[].name_th` | `string` | ใช่ |
| `items[].name_en` | `string` | ใช่ |
| `items[].price` | `Money` | ใช่ |
| `items[].price.satang` | `integer` | ใช่ |
| `items[].price.currency` | `string = THB` | ใช่ |
| `items[].price_per_credit` | `object` | ใช่ |
| `items[].credits` | `integer` | ใช่ |
| `items[].validity_days` | `integer = 365` | ใช่ |
| `items[].for_sale` | `boolean` | ใช่ |
| `items[].sort` | `integer` | ใช่ |

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

429 500

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

**cURL**

```bash
curl https://api.checkslip.com/api/billing/packages \
  -H "Authorization: Bearer $CHECKSLIP_API_KEY"
```

**Node.js**

```javascript
const res = await fetch("https://api.checkslip.com/api/billing/packages", {
  headers: {
    Authorization: `Bearer ${process.env.CHECKSLIP_API_KEY}`,
  },
});
const data = await res.json();
```

**Python**

```python
import os

import requests

res = requests.get(
    "https://api.checkslip.com/api/billing/packages",
    headers={
        "Authorization": f"Bearer {os.environ['CHECKSLIP_API_KEY']}",
    },
)
data = res.json()
```

```json
{
  "checkout_open": true,
  "prices_include_vat": true,
  "items": [
    {
      "code": "tester",
      "name_th": "string",
      "name_en": "string",
      "price": {
        "satang": 5000,
        "currency": "THB"
      },
      "price_per_credit": {
        "satang": 5000,
        "currency": "THB"
      },
      "credits": 1,
      "validity_days": 365,
      "for_sale": true,
      "sort": 1
    }
  ]
}
```
