Skip to content

GET /bank-accounts

ดูรายการบัญชีธนาคารที่เชื่อมโยงกับ Branch ที่เรียกใช้ ผลลัพธ์แบ่งหน้า (paginated) และไม่รวมบัญชีที่ถูกลบ

Endpoint

http
GET /bank-accounts

URL เต็ม: https://api.easyslip.com/v2/bank-accounts

การยืนยันตัวตน

จำเป็น ดูคู่มือการยืนยันตัวตน

http
Authorization: Bearer YOUR_API_KEY

Request

Query Parameters

พารามิเตอร์ชนิดจำเป็นคำอธิบาย
typestringไม่กรองตามประเภทบัญชี — NATURAL หรือ JURISTIC
bankCodestringไม่กรองตามรหัสธนาคาร
pagenumberไม่หมายเลขหน้า (ค่าเริ่มต้น: 1)
limitnumberไม่จำนวนรายการต่อหน้า (ค่าเริ่มต้น: 20, สูงสุด: 100)

Type Definitions

typescript
// Response
interface ListBankAccountsResponse {
  success: true;
  data: {
    items: BankAccount[];
    total: number;
    page: number;
    limit: number;
  };
}

interface BankAccount {
  id: number;
  bankCode: string;
  bankNumber: string;
  nameTh: string;
  nameEn: string;
  type: 'NATURAL' | 'JURISTIC';
  extraVerify: string | null;
  createdAt: string;                   // ISO 8601
  updatedAt: string;                   // ISO 8601
}

// Error Response
interface ErrorResponse {
  success: false;
  error: {
    code: string;
    message: string;
  };
}

ตัวอย่าง

bash
curl -X GET "https://api.easyslip.com/v2/bank-accounts?type=JURISTIC&page=1&limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY"
javascript
const listBankAccounts = async (params = {}) => {
  const query = new URLSearchParams(params).toString();
  const response = await fetch(`https://api.easyslip.com/v2/bank-accounts?${query}`, {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const result = await response.json();

  if (!result.success) {
    throw new Error(result.error.message);
  }

  return result.data;
};

// การใช้งาน
const { items, total } = await listBankAccounts({ type: 'JURISTIC', limit: 20 });
console.log(`แสดง ${items.length} จาก ${total} บัญชี`);
php
function listBankAccounts(array $params = []): array
{
    $query = http_build_query($params);
    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => 'https://api.easyslip.com/v2/bank-accounts?' . $query,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer YOUR_API_KEY'
        ]
    ]);

    $response = curl_exec($ch);
    curl_close($ch);

    $result = json_decode($response, true);

    if (!$result['success']) {
        throw new Exception($result['error']['message']);
    }

    return $result['data'];
}

// การใช้งาน
$data = listBankAccounts(['type' => 'JURISTIC', 'limit' => 20]);
echo "ทั้งหมด: " . $data['total'];
python
import requests

def list_bank_accounts(**params) -> dict:
    response = requests.get(
        'https://api.easyslip.com/v2/bank-accounts',
        headers={'Authorization': 'Bearer YOUR_API_KEY'},
        params=params
    )

    result = response.json()

    if not result['success']:
        raise Exception(result['error']['message'])

    return result['data']

# การใช้งาน
data = list_bank_accounts(type='JURISTIC', limit=20)
print(f"แสดง {len(data['items'])} จาก {data['total']} บัญชี")

Response

สำเร็จ (200)

json
{
  "success": true,
  "data": {
    "items": [
      {
        "id": 12345,
        "bankCode": "004",
        "bankNumber": "123-4-56789-0",
        "nameTh": "บริษัท ตัวอย่าง จำกัด",
        "nameEn": "EXAMPLE CO., LTD.",
        "type": "JURISTIC",
        "extraVerify": null,
        "createdAt": "2024-01-15T14:30:00+07:00",
        "updatedAt": "2024-01-15T14:30:00+07:00"
      }
    ],
    "total": 1,
    "page": 1,
    "limit": 20
  }
}

ฟิลด์ใน Response

ฟิลด์ชนิดคำอธิบาย
itemsBankAccount[]บัญชีที่เชื่อมโยงกับ Branch ที่เรียกใช้
totalnumberจำนวนบัญชีที่ตรงเงื่อนไขทั้งหมด
pagenumberหมายเลขหน้าปัจจุบัน
limitnumberจำนวนรายการต่อหน้า

Error Responses

Validation Error (400)

json
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "limit: Too big: expected number to be <=100"
  }
}

หมายเหตุ

  • ระบบจะคืนเฉพาะบัญชีที่เชื่อมโยงกับ Branch ที่เรียกใช้เท่านั้น
  • บัญชีที่ถูกลบจะไม่รวมอยู่ในผลลัพธ์
  • limit สูงสุดไม่เกิน 100

Bank Slip Verification API for Thai Banking