Skip to content

GET /bank-accounts/:id ​

ดูบัญชีธนาคารรายการเดียวตาม id เข้าถึงได้เฉพาะเมื่อบัญชีเชื่อมโยงกับ Branch ที่เรียกใช้ มิฉะนั้นจะได้รับ 404

Endpoint ​

http
GET /bank-accounts/:id

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

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

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

http
Authorization: Bearer YOUR_API_KEY

Request ​

Path Parameters ​

พารามิเตอร์ชนิดจำเป็นคำอธิบาย
idnumberใช่id ของบัญชีธนาคาร

Type Definitions ​

typescript
// Response
interface GetBankAccountResponse {
  success: true;
  data: BankAccount;
}

interface BankAccount {
  id: number;
  bankCode: string;
  bankNumber: string;
  nameTh: string;
  nameEn: string;
  type: 'NATURAL' | 'JURISTIC';
  extraVerify: string | null;
  matchMode: 'NAME' | 'NUMBER' | 'NAME_NUMBER' | 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/12345 \
  -H "Authorization: Bearer YOUR_API_KEY"
javascript
const getBankAccount = async (id) => {
  const response = await fetch(`https://api.easyslip.com/v2/bank-accounts/${id}`, {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const result = await response.json();

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

  return result.data;
};

// การใช้งาน
const account = await getBankAccount(12345);
console.log('บัญชี:', account.nameEn, account.bankNumber);
php
function getBankAccount(int $id): array
{
    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => 'https://api.easyslip.com/v2/bank-accounts/' . $id,
        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'];
}

// การใช้งาน
$account = getBankAccount(12345);
print_r($account);
python
import requests

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

    result = response.json()

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

    return result['data']

# การใช้งาน
account = get_bank_account(12345)
print('บัญชี:', account['nameEn'], account['bankNumber'])

Response ​

สำเร็จ (200) ​

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

matchMode ของ PromptPay

สำหรับบัญชี PromptPay ค่า matchMode จะเป็น NAME, NUMBER หรือ NAME_NUMBER ค่าเดิมที่ไม่มี/เป็น null จะคืนเป็น NUMBER โดย extraVerify ยังเป็นเงื่อนไขบังคับของประเภท PromptPay proxy ในทุกโหมด บัญชีที่ไม่ใช่ PromptPay จะคืน matchMode: null

Error Responses ​

ไม่พบบัญชีธนาคาร (404) ​

json
{
  "success": false,
  "error": {
    "code": "BANK_ACCOUNT_NOT_FOUND",
    "message": "Bank account not found"
  }
}

หมายเหตุ ​

  • คืนค่า 404 BANK_ACCOUNT_NOT_FOUND หากไม่พบบัญชี หรือ บัญชีไม่ได้เชื่อมโยงกับ Branch ของคุณ โดยทั้งสองกรณีจะแยกไม่ออกจากกันโดยเจตนา

Bank Slip Verification API for Thai Banking