ข้ามไปที่เนื้อหา

Accumulate Points from Transaction Amount (Add Point)

ใช้สำหรับการคำนวณแต้มและเพิ่มแต้มสะสมให้แก่สมาชิก โดยส่งยอดจำนวนเงินที่ทำรายการจริง (Transaction Amount) เข้ามา เพื่อให้ระบบทำการเปลี่ยนมูลค่าเงินเป็นแต้มสะสมตามอัตราส่วนของทางร้านค้า (เช่น ทุกๆ 25 บาท รับ 1 แต้ม)

  • Endpoint: /openapi/v1/points/add-point
  • Method: POST
  • Authentication Required: API Key (X-API-Key)

Request Body Parameters

Parameter Type Required Description Example
phone string Yes เบอร์โทรศัพท์หรือเครื่องมือค้นหาสมาชิกเพื่อสะสมแต้ม "0812345678"
amount decimal Yes ยอดเงินรวมของยอดใช้จ่ายจริง (ต้องเป็นจำนวนบวก มากกว่า 0) 1000.00
invoice_no string Yes เลขที่ใบเสร็จหรือหมายเลขคำสั่งซื้ออ้างอิง "INV-20260708-099"
branch_code string No รหัสสาขาที่ทำรายการ "BKK01"
remark string No หมายเหตุเพิ่มเติมสำหรับการสะสมแต้มครั้งนี้ "ซื้อสินค้าหมวดไอที"

Request Example

{
  "phone": "0812345678",
  "amount": 1000.00,
  "invoice_no": "INV-20260708-099",
  "branch_code": "BKK01",
  "remark": "ซื้อสินค้าหมวดไอที"
}

Response Examples

{
  "success": true,
  "data": {
    "member_id": "M-20260708001",
    "phone": "0812345678",
    "invoice_no": "INV-20260708-099",
    "transaction_amount": 1000.00,
    "points_earned": 40,
    "previous_balance": 410,
    "new_balance": 450,
    "transaction_id": "TXN-PT-20260708002",
    "processed_at": "2026-07-08T10:45:12Z"
  },
  "message": "Points successfully added by transaction amount (Rate: 25 THB = 1 Point)."
}
{
  "success": false,
  "error": {
    "code": "INVALID_AMOUNT",
    "message": "ยอดใช้จ่ายต้องไม่ต่ำกว่าขั้นต่ำในการคำนวณแต้ม (ขั้นต่ำ 25 บาท)"
  }
}