บิลเพย์เมนต์

หัวข้อทั้งหมดในหน้านี้

ช่องทางบิลเพย์เมนต์จะช่วยให้ผู้ซื้อสามารถชำระค่าสินค้าและบริการด้วยเงินสด โดยการนำบาร์โค้ดที่ได้รับจากร้านค้าไปแสดงที่หน้าเคาน์เตอร์บริการ

ปัจจุบันผู้ซื้อสามารถนำบาร์โค้ดไปสแกนจ่ายได้ที่เคาน์เตอร์บริการของโลตัสกว่า 1,800 สาขาทั่วประเทศ และกำลังขยายให้มีเคาน์เตอร์บริการอื่นเพิ่มเติมเร็วๆ นี้

* โลตัสมีการคิดค่าธรรมเนียมการชำระเงินรายการละ 10 บาท

การเปิดรับชำระเงิน

  • ประเทศที่รองรับ: ประเทศไทย
  • API เวอร์ชันล่าสุดที่รองรับ: 2017-11-02

ร้านค้าที่ต้องการเปิดใช้ระบบ บิลเพย์เมนต์ กรุณาส่งอีเมลมาที่ support@opn.ooo ทางทีมงาน Opn Payments จะส่งข้อกำหนดและเงื่อนไขการใช้บริการให้ร้านค้าได้พิจารณาและลงลายมือชื่อก่อนเปิดใช้งานจริง

ขั้นตอนการชำระเงิน

เมื่อผู้ซื้อมาถึงขั้นตอนการชำระเงินหลังจากใส่รายละเอียดในการจัดส่งและยืนยันรายการสินค้าเรียบร้อยแล้ว ขั้นตอนต่อไปผู้ซื้อจะทำการเลือกวิธีการชำระด้วย Lotus's Bill Payment ดังรูปต่อไปนี้

Bill payment flow

ระบบจะทำการสร้างบาร์โค้ดเพื่อให้ผู้ซื้อนำไปสแกนชำระเงินที่หน้าเคาน์เตอร์บริการของโลตัส บาร์โค้ดจะหมดอายุใน 24 ชั่วโมง

Bill payment flow 2

บาร์โค้ดที่แสดงต่อเจ้าหน้าที่ ณ เคาน์เตอร์ชำระเงินจะต้องมีความสูงไม่น้อยกว่า 1 เซนติเมตร

การติดตั้งใช้งาน

ในการสร้างรายการรับชำระเงินผ่านบิลเพย์เมนต์ ให้ร้านค้าส่งคำสั่ง API ดังนี้

  1. สร้าง payment source (type: bill_payment_tesco_lotus) โดยใช้ Omise.js, omise-ios หรือ omise-android
  2. สร้าง charge โดยใช้ source จากขั้นตอนแรก
  3. เมื่อผู้ซื้อทำรายการสำเร็จและร้านค้าได้รับ webhook event หรือ charge.complete แล้ว เราแนะนำให้ตรวจสอบสถานะรายการด้วยตนเองอีกครั้งเพื่อความแม่นยำ

การสร้าง source เพื่อรับชำระเงินผ่านบิลเพย์เมนต์ จะเกิดขึ้นในฝั่งของผู้ซื้อ (client-side) เช่นบนเว็บไซต์หรือโทรศัพท์มือถือของผู้ซื้อ ร้านค้าจะต้องใช้ public key

ส่วนการสร้างรายการ (charge) เพื่อรับชำระเงินผ่านบิลเพย์เมนต์ จะเกิดขึ้นในฝั่งของร้านค้า (server-side) ร้านค้าจะต้องใช้ secret key

หมายเหตุ: หากมีความจำต้องสร้างทั้งรายการและ source ในฝั่งร้านค้า (server-side) สามารถทำพร้อมกันได้เลยโดยการส่งคำสั่ง API เพียงครั้งเดียว และใช้งาน secret key

การสร้าง source

เมื่อผู้ซื้อเลือกชำระเงินผ่านช่องทางนี้ ให้ร้านค้าสร้าง source ผ่าน source API โดยกำหนด amount, currency, และ type

ตัวอย่างด้านล่างนี้เป็นการสร้าง source สำหรับรายการ บิลเพย์เมนต์ จำนวน ฿4,000 ให้แทนค่าของ omise_public_key และ $OMISE_PUBLIC_KEY ด้วย test public key ของร้านค้าซึ่งสามารถคัดลอกได้จาก แดชบอร์ด

หากใช้ Omise.js parameter type เป็นตัวแปรที่จำเป็นของฟังก์ชัน createSource

Omise.setPublicKey(omise_public_key);

Omise.createSource('bill_payment_tesco_lotus', {
  "amount": 400000,
  "currency": "THB"
}, function(statusCode, response) {
  console.log(response)
});

หากร้านค้าต้องการทดสอบให้สร้าง request โดยใช้ curl

curl https://api.omise.co/sources \
  -u $OMISE_PUBLIC_KEY: \
  -d "amount=400000" \
  -d "currency=THB" \
  -d "type=bill_payment_tesco_lotus"
{
  "object": "source",
  "id": "src_test_5lwtu22idn5u77hon87",
  "livemode": false,
  "location": "/sources/src_test_5lwtu22idn5u77hon87",
  "amount": 400000,
  "barcode": null,
  "created_at": "2020-11-18T01:47:44Z",
  "currency": "THB",
  "email": null,
  "flow": "offline",
  "installment_term": null,
  "name": null,
  "mobile_number": null,
  "phone_number": null,
  "scannable_code": null,
  "references": null,
  "store_id": null,
  "store_name": null,
  "terminal_id": null,
  "type": "bill_payment_tesco_lotus",
  "zero_interest_installments": null,
  "charge_status": "unknown"
}

ตัวแปรของ id คือ source identifier (เริ่มต้นด้วย src)

การสร้างรายการรับชำระเงิน

สร้างรายการรับชำระเงินโดยระบุ parameter source, amount และ currency

  • source จะเป็นตัวกำหนด source identifier
  • amount และ currency จะต้องมีค่าตรงกับ amount และ currency ของ source

ตัวอย่างด้านล่างนี้แสดงการสร้างรายการรับชำระเงินขึ้นใหม่ โดยใช้ curl

ในการสร้างรายการให้ร้านค้าแทน $OMISE_SECRET_KEY ด้วย test secret key ของร้านค้าซึ่งสามารถคัดลอกได้จากแดชบอร์ด และแทน $SOURCE_ID ด้วย id ของ source

curl https://api.omise.co/charges \
  -u $OMISE_SECRET_KEY: \
  -d "amount=400000" \
  -d "currency=THB" \
  -d "source=$SOURCE_ID"
{
  "object": "charge",
  "id": "chrg_test_5lwtu27dt33df7yup34",
  "location": "/charges/chrg_test_5lwtu27dt33df7yup34",
  "amount": 400000,
  "net": 384378,
  "fee": 14600,
  "fee_vat": 1022,
  "interest": 0,
  "interest_vat": 0,
  "funding_amount": 400000,
  "refunded_amount": 0,
  "authorized": false,
  "capturable": false,
  "capture": true,
  "disputable": false,
  "livemode": false,
  "refundable": false,
  "reversed": false,
  "reversible": false,
  "voided": false,
  "paid": false,
  "expired": false,
  "platform_fee": {
    "fixed": null,
    "amount": null,
    "percentage": null
  },
  "currency": "THB",
  "funding_currency": "THB",
  "ip": null,
  "refunds": {
    "object": "list",
    "data": [],
    "limit": 20,
    "offset": 0,
    "total": 0,
    "location": "/charges/chrg_test_5lwtu27dt33df7yup34/refunds",
    "order": "chronological",
    "from": "1970-01-01T00:00:00Z",
    "to": "2020-11-18T01:47:45Z"
  },
  "link": null,
  "description": null,
  "metadata": {},
  "card": null,
  "source": {
    "object": "source",
    "id": "src_test_5lwtu1jlbbor0frzujw",
    "livemode": false,
    "location": "/sources/src_test_5lwtu1jlbbor0frzujw",
    "amount": 400000,
    "barcode": null,
    "created_at": "2020-11-18T01:47:42Z",
    "currency": "THB",
    "email": null,
    "flow": "offline",
    "installment_term": null,
    "name": null,
    "mobile_number": null,
    "phone_number": null,
    "scannable_code": null,
    "references": {
      "expires_at": "2020-11-19T01:47:45Z",
      "device_id": null,
      "customer_amount": null,
      "customer_currency": null,
      "customer_exchange_rate": null,
      "omise_tax_id": "0105556091152",
      "reference_number_1": "805297907253923407",
      "reference_number_2": "476051633629737131",
      "barcode": "https://api.omise.co/charges/chrg_test_5lwtu27dt33df7yup34/documents/docu_test_5lwtu28qacvz5gy69ee/downloads/2AFDE498E911C51A",
      "payment_code": null,
      "va_code": null
    },
    "store_id": null,
    "store_name": null,
    "terminal_id": null,
    "type": "bill_payment_tesco_lotus",
    "zero_interest_installments": null,
    "charge_status": "pending"
  },
  "schedule": null,
  "customer": null,
  "dispute": null,
  "transaction": null,
  "failure_code": null,
  "failure_message": null,
  "status": "pending",
  "authorize_uri": null,
  "return_uri": null,
  "created_at": "2020-11-18T01:47:45Z",
  "paid_at": null,
  "expires_at": "2020-11-19T01:47:45Z",
  "expired_at": null,
  "reversed_at": null,
  "zero_interest_installments": true,
  "branch": null,
  "terminal": null,
  "device": null
}

การสร้าง source และรายการรับชำระเงิน

ร้านค้าสามารถสร้างทั้ง source และ รายการรับชำระเงิน (charge) ผ่านการเรียกใช้ API เพียงครั้งเดียว

curl https://api.omise.co/charges \
  -u $OMISE_SECRET_KEY: \
  -d "amount=400000" \
  -d "currency=THB" \
  -d "source[type]=bill_payment_tesco_lotus"

สร้างรายการสำเร็จ

เมื่อร้านค้าสร้างรายการรับชำระเงินขึ้นมาแล้ว จะพบว่าสถานะของรายการแสดงเป็น pending หรือ status==pending โดยสถานะของรายการรับชำระเงินสามารถเป็นได้ทั้ง successful, failed และ expired

ในส่วนต่อไปเราจะอธิบายวิธีอนุมัติรายการ, การรับ event แจ้งเตือนเมื่อรายการเสร็จสิ้นผ่าน webhook และการตรวจสอบสถานะรายการ

ภาพด้านล่างนี้แสดงให้เห็นถึงขั้นตอนทั้งหมดในการรับชำระเงินแต่ละรายการ

sequenceDiagram participant customer participant omise.js participant merchant participant api.omise.co participant offline provider customer->>omise.js: Send payment details for purchase omise.js->>api.omise.co: Request source using payment details api.omise.co-->>omise.js: Return source omise.js->>merchant: Merchant gets returned source merchant->>api.omise.co: Request charge using source and purchase details api.omise.co-xmerchant: Send "charge.create" webhook api.omise.co-->>merchant: Return charge customer->>offline provider: Provide payment or charge authorization at offline provider offline provider-->>api.omise.co: Return result of payment or charge authorization api.omise.co-xmerchant: Send "charge.complete" webhook merchant-xcustomer: Send charge result (e.g. via email)

การอนุมัติรายการ

ผู้ซื้อจะต้องแสดงบาร์โค้ดที่ถูกสร้างขึ้นให้กับเคาน์เตอร์ โลตัส เพื่ออนุมัติรายการ

{
  "expires_at": "2020-11-19T01:47:43Z",
  "device_id": null,
  "customer_amount": null,
  "customer_currency": null,
  "customer_exchange_rate": null,
  "omise_tax_id": "0105556091152",
  "reference_number_1": "312976326328476486",
  "reference_number_2": "653020046799062983",
  "barcode": "https://api.omise.co/charges/chrg_test_5lwtu1skco2znhlaqxy/documents/docu_test_5lwtu1tz9qm28bxmky2/downloads/C6B1E93898DC97F2",
  "payment_code": null,
  "va_code": null
}

การรับ event แจ้งเตือนรายการสำเร็จ

ร้านค้าสามารถรับการแจ้งเตือนเมื่อมีการทำรายการเสร็จสิ้นโดยใช้งาน webhook events

ในการติดตั้งให้ร้านค้ากำหนดตำแหน่งบนเซิร์ฟเวอร์เพื่อรับ webhook events และเพิ่มตำแหน่งเดียวกันนี้เป็น webhook endpoint บนแดชบอร์ด

เมื่อมีรายการเสร็จสิ้นระบบจะส่ง POST request ไปยัง endpoint นี้ พร้อมทั้งแนบสถานะการตอบกลับของรายการนั้นๆ ไปด้วย

ตัวแปรหลักหรือ key สำหรับ event object ประกอบไปด้วย charge.complete และตัวแปร data ที่มี charge object

อ่านเพิ่มเติมได้ที่ Events API

การตรวจสอบสถานะรายการ

เมื่อได้รับ event ของรายการที่เสร็จสิ้นแล้ว ร้านค้าสามารถตรวจสอบสถานะรายการหรือ status โดยใช้ Charge API

หากค่าของ charge.status เป็น successful หมายถึงว่ารายการรับชำระเงินสำเร็จ หากค่าของ charge.status เป็น failed รายการรับชำระเงินนั้นไม่สำเร็จ ร้านค้าสามารถตรวจสอบ failure_code และ failure_message ได้ใน charge object เพื่ออ่านคำอธิบายเพิ่มเติม

สาเหตุขัดข้องที่อาจเกิดขึ้นได้มีดังนี้

รหัสข้อขัดข้อง รายละเอียด
timeout ผู้ซื้อไม่ยืนยันการทำรายการภายในเวลาที่กำหนด

การยกเลิกรายการและการคืนเงิน

รายการที่ชำระผ่านบิลเพย์เมนต์ยังไม่สามารถทำการยกเลิกรายการหรือการคืนเงินได้ผ่าน Opn Payments กรุณาติดต่อโลตัสโดยตรง

ข้อจำกัด

  • จำนวนรับชำระขั้นต่ำ: 2000 (THB20.00)
  • จำนวนรับชำระสูงสุด: 4900000 (THB49,000.00)

ขั้นตอนต่อไป

เว็ปไซต์นี้มีการใช้คุกกี้เพื่อวิเคราะห์การใช้และปรับการใช้งานให้เหมาะกับท่าน เมื่อกดยอมรับหรือยังคงเข้าชมเว็บไซต์ต่อ เราถือว่าท่านยินยอมในการใช้งานคุกกี้ของเว็บไซต์ อ่านนโยบายความเป็นส่วนตัว