API Documentation

Integrate ShopChill Dropoff into your own applications

Download Postman Collection: ShopChill-Dropoff-API.postman_collection.json

Authentication

ลูกค้า / Postman: ใช้ Basic Auth (Base64 ของ username:password) กับ endpoint ที่ระบุว่า “ต้อง auth”

หน้าเว็บที่ล็อกอินแล้วเรียก API เดียวกันได้ด้วย session cookie — คำขอแบบ POST/PUT/PATCH ต้องส่ง header X-CSRF-TOKEN ให้ตรงกับ meta csrf ในหน้า

Authorization: Basic U0NEWFgxOnBhc3N3b3JkMTIz
POST

/api/v1/dropoff/register

Register a new shop/point of service. This endpoint is public but requires valid data.

Full Request Schema (Multipart Form)

Field Type Required Description
AUTHENTICATION & CORE
platform_name String Yes ชื่อแพลตฟอร์ม (ภาษาอังกฤษและตัวเลขเท่านั้น)
CONTACT INFORMATION
contact_name String No ชื่อผู้ติดต่อ
phone_number String No เบอร์โทรศัพท์
email Email No อีเมล
LOCATION & ADDRESS
address_sub_district String No ตำบล / แขวง
address_district String No อำเภอ / เขต
address_province String No จังหวัด
postal_code String No รหัสไปรษณีย์
map_link String No ลิงก์แผนที่ (Google Maps)
OPERATIONAL INFO
open_day_type String No วันเปิดทำการ (เช่น Mon-Fri, Mon-Sun)
open_time String No เวลาเปิด (HH:MM)
close_time String No เวลาปิด (HH:MM)
FACILITIES & FEATURES
cctv_recorded Boolean No มีกล้องวงจรปิดหรือไม่
barcode_scanner Boolean No มีเครื่องแสกนบาร์โค้ดหรือไม่
has_computer Boolean No มีคอมพิวเตอร์หรือไม่
OPERATIONAL ASSETS (IMAGES)
store_front_image File No รูปหน้าร้าน
storage_area_image File No รูปบริเวณพื้นที่เก็บของ
parking_area_image File No รูปที่จอดรถ
recommended_parking_image File No รูปที่จอดรถที่แนะนำ

Response Example (Success 201)

{
  "status": "success",
  "message": "Registration successful.",
  "user_details": {
    "username": "SCDXX123",
    "password": "secret_password",
    "user_id": 45
  }
}

Example (cURL)

curl -X POST https://uat-droppoint.shopchill.net/api/v1/dropoff/register \
  -F "platform_name=My Ecommerce" \
  -F "password=secret123"

HTTP Status Codes

201 CreatedMember registered and username generated.
422 ErrorValidation failed (missing required fields or invalid format).
POST

/api/v1/dropoff/tracking/status

เช็กสถานะหลายรายการในครั้งเดียว (public endpoint)

Request Body (JSON)

{
  "tracking_numbers": [
    "TH1234",
    "TH1235",
    "TH1238",
    "TH1237"
  ]
}

Response Example (Success 200)

{
  "status": "success",
  "data": [
    {
      "courier_code": "JNT",
      "tracking": "TH1234",
      "pickedup_date": 1715153400,
      "updated_at": 1715157800,
      "status": "pickedup"
    }
  ]
}

pickedup_date ส่งเป็น unix time จาก orders.pickedup_at (ถ้าไม่มีค่า จะได้ null) และส่ง updated_at เป็น unix time เพิ่มเติม โดย status map จาก orders.status ไป order_statuses.name

POST

/api/v1/dropoff/record

Record a new dropoff scan. Requires Authentication.

Request Body (JSON)

Field Type Required Description
tracking_number String Yes เลข tracking หรือรหัส order (orders.tracking / orders.code) — ต้องมีในระบบหลักก่อนบันทึก
received_by_username String Yes The username (SCDXX) of the service point

Response Example (Success 201)

{
  "status": "success",
  "message": "Order recorded successfully.",
  "order_details": {
    "id": 101,
    "tracking_number": "TH1234567890",
    "scanned_input": "TH1234567890",
    "member_username": "SCDXX1",
    "recorded_by": "SCDXX1",
    "received_at": "2026-05-08 10:14:00",
    "courier_code": "JNT",
    "src_name": "สมชาย ใจดี",
    "src_phone": "0812345678",
    "dst_name": "บริษัท ตัวอย่าง จำกัด",
    "dst_phone": "029999999"
  }
}

HTTP Status Codes

201 CreatedScan recorded successfully.
404 Not Foundค่าที่ส่งไม่ตรง orders.tracking หรือ orders.code ในตารางหลัก หรือไม่พบ member — not found in main orders.
409 ConflictTracking number already exists in the system.
401 ErrorAuthentication failed (Check Basic Auth header).

Example (cURL)

curl -X POST https://uat-droppoint.shopchill.net/api/v1/dropoff/record \
  -H "Authorization: Basic Base64(user:pass)" \
  -H "Content-Type: application/json" \
  -d '{"tracking_number": "XYZ123", "received_by_username": "SCDXX1"}'

รายงานการสแกน

ดึงรายการสแกนพร้อม ผู้นำฝาก จาก orders.src_name (จับคู่ tracking หรือ code กับค่าที่สแกน) — ต้อง auth เหมือน endpoint อื่น

  • GET /api/v1/dropoff/reports/scanners — รายชื่อผู้แสกน (received_by) สำหรับ dropdown
  • GET /api/v1/dropoff/reports/scans — รายงานแบบแบ่งหน้า
  • DELETE /api/v1/dropoff/reports/scans/{dropoffOrder} — ลบรายการสแกนตาม id

Query (reports/scans)

พารามิเตอร์ ค่า หมายเหตุ
preset today | week | month ช่วงเวลาเริ่มจันทร์–อาทิตย์สำหรับ week (เวลาไทย)
date_from วันที่ (YYYY-MM-DD) ถ้ามี date_from / date_to จะไม่ใช้ preset
date_to วันที่ (YYYY-MM-DD)
scanner string กรองตาม received_by (ผู้แสกน) ตรงกับค่าจาก reports/scanners
per_page 1–100 ค่าเริ่มต้น 50
page integer แบ่งหน้า

ถ้าไม่ส่ง preset และไม่ส่งช่วงวันที่ ระบบใช้ช่วง วันนี้ (Asia/Bangkok)

โปรไฟล์จุดรับฝาก

อ่าน/แก้ข้อมูลเดียวกับตอนสมัคร และเปลี่ยนรหัสผ่าน — ใช้ Basic Auth (หรือ session จากเว็บพร้อม CSRF)

  • GET /api/v1/dropoff/me — ข้อมูลโปรไฟล์ (JSON)
  • PUT /api/v1/dropoff/profile — อัปเดตข้อมูล + รูป (multipart/form-data) ฟิลด์เหมือน register
  • PATCH /api/v1/dropoff/password — body JSON: current_password, new_password, new_password_confirmation