ดึงรายการเงินเข้า/ออกจากบัญชีธนาคารของคุณ ไปจับคู่กับออเดอร์ในระบบของคุณเอง
GokuPay ดักการแจ้งเตือนเงินเข้า/ออกจาก SMS ธนาคาร และ LINE (KBank Live / SCB Connect) แล้วแปลงเป็นรายการมาตรฐานให้คุณดึงไปใช้ผ่าน API เดียว — กันข้อความซ้ำและรองรับการแจ้งช้าให้ในตัว
/api_moneyinดึงรายการเงินเข้า/ออกล่าสุดของบัญชีในโปรไฟล์นั้น
| ชื่อ | จำเป็น | คำอธิบาย |
|---|---|---|
| api_key | ✔ | คีย์ของโปรไฟล์ |
| direction | - | all (ค่าเริ่มต้น) · in เฉพาะเงินเข้า · out เฉพาะเงินออก |
| limit | - | จำนวนรายการ 1-200 (ค่าเริ่มต้น 50) |
| bank | - | กรองธนาคาร เช่น KBANK, SCB |
curl "https://pay.teddynes.com/api_moneyin?api_key=gpay_xxx&direction=in&limit=20"
{
"status": "success",
"data": [{
"bank": "KBANK", // ธนาคารเจ้าของบัญชี
"direction": "in", // in = เงินเข้า, out = เงินออก
"date": "19/08/69", // วันที่ (พ.ศ.)
"time": "02:47",
"account": "xxx-x-x8998-x", // บัญชีที่รับเงิน (ปิดบังตามที่ธนาคารส่ง)
"from_bank": null, // ธนาคารต้นทาง (ถ้าธนาคารแจ้ง)
"amount": "320.50",
"amount_cents": 32050, // ใช้ตัวนี้เทียบยอด (int กัน float เพี้ยน)
"balance": "5000.00",
"received_at": "2026-08-19T02:47:10.000Z" // UTC
}]
}
⚠️ api_key ผิด → HTTP 401
ดึงทุก ~10 วินาที แล้วจับคู่กับออเดอร์ที่รอจ่าย
const KEY = 'gpay_xxx'; const seen = new Set(); // กันประมวลผลซ้ำ (ควรเก็บลง DB จริง) async function poll() { const r = await fetch(`https://pay.teddynes.com/api_moneyin?api_key=${KEY}&direction=in&limit=50`); const { data } = await r.json(); for (const tx of data) { const key = `${tx.received_at}|${tx.amount_cents}|${tx.account}`; if (seen.has(key)) continue; seen.add(key); // จับคู่ออเดอร์: ยอดตรง + ยังไม่หมดอายุ (แนะนำเผื่อเวลา 10-30 นาที) const order = await findPendingOrder({ amountCents: tx.amount_cents, after: new Date(Date.now() - 30 * 60 * 1000), }); if (!order) continue; // ไม่เจอ -> เก็บไว้ตรวจภายหลัง if (order.length > 1) { flagForReview(tx); continue; } // ยอดซ้ำ -> อย่าเดา await markPaid(order[0].id, tx); } } setInterval(poll, 10000);
amount_cents (int) ไม่ใช่ทศนิยมreceived_at + amount + account)
/api_moneyin