ใหม่ PayNext Extra Installment QR
หัวข้อทั้งหมดในหน้านี้
เพิ่มตัวเลือกการรับชำระเงินสำหรับลูกค้าที่ต้องการชำระเงินผ่าน TrueMoney ด้วย PayNext Extra Installment บนระบบ POS ของคุณ
โดยในคู่มือแนะนำการใช้งานนี้จะอธิบายขั้นตอนการชำระเงิน และรายละเอียดวิธีการเปิดรับชำระเงินผ่าน TrueMoney ด้วย PayNext Extra Installment QR
การเปิดรับชำระเงิน
- ประเทศที่รองรับ: ประเทศไทย
- API เวอร์ชันล่าสุดที่รองรับ:
2017-11-02
ร้านค้าที่ต้องการเปิดใช้ระบบ PayNext Extra Installment QR กรุณาส่งอีเมลมาที่ support@opn.ooo ทางทีมงานโอเพ่นจะส่งข้อกำหนดและเงื่อนไขการใช้บริการให้ร้านค้าได้พิจารณาและลงลายมือชื่อก่อนเปิดใช้งานจริง
ขั้นตอนการชำระเงิน
ผู้ซื้อที่ชำระเงินด้วย PayNext Extra Installment QR จะต้องดำเนินขั้นตอนการชำระเงินผ่านช่องทางออฟไลน์ ซึ่งรายการรับชำระเงินที่ถูกสร้างขึ้น จะได้รับการอนุมัติผ่านทาง “ออฟไลน์” เท่านั้น
เมื่อผู้ซื้อเลือก PayNext Extra Installment QR เว็บไซต์ของร้านค้าจะแสดงคิวอาร์โค้ดบน POS ให้ผู้ซื้อใช้แอป TrueMoney บนโทรศัพท์มือถือสแกนคิวอาร์โค้ดดังกล่าว
หลังจากสแกนคิวอาร์โค้ดแล้ว ระบบจะส่งลูกค้าไปยังหน้าผ่อนชำระเพื่อเลือกระยะเวลาการผ่อนชำระและอัตราดอกเบี้ย จากนั้น ระบบจะแสดงข้อมูลการชำระเงินให้ผู้ซื้อ เพื่อยืนยันการชำระเงินตามขั้นตอน
การติดตั้งใช้งาน
ในการสร้างรายการรับชำระเงินผ่านPayNext Extra Installment QR ให้ร้านค้าส่งคำสั่ง API ดังนี้
- สร้าง payment source (
type
:installment_paynext_extra_qr
) โดยใช้ Omise.js, omise-ios หรือ omise-android - สร้าง charge โดยใช้ source จากขั้นตอนแรก
- เมื่อผู้ซื้อทำรายการสำเร็จและร้านค้าได้รับ webhook event หรือ
charge.complete
แล้ว เราแนะนำให้ตรวจสอบสถานะรายการด้วยตนเองอีกครั้งเพื่อความแม่นยำ
การสร้าง source เพื่อรับชำระเงินผ่านPayNext Extra Installment QR จะเกิดขึ้นในฝั่งของผู้ซื้อ (client-side) เช่นบนเว็บไซต์หรือโทรศัพท์มือถือของผู้ซื้อ ร้านค้าจะต้องใช้ public key
ส่วนการสร้างรายการ (charge) เพื่อรับชำระเงินผ่านPayNext Extra Installment QR จะเกิดขึ้นในฝั่งของร้านค้า (server-side) ร้านค้าจะต้องใช้ secret key
หมายเหตุ: หากมีความจำต้องสร้างทั้งรายการและ source ในฝั่งร้านค้า (server-side) สามารถทำพร้อมกันได้เลยโดยการส่งคำสั่ง API เพียงครั้งเดียว และใช้งาน secret key
การสร้าง source
เมื่อผู้ซื้อเลือกชำระเงินผ่านช่องทางนี้ ให้ร้านค้าสร้าง source ผ่าน source API โดยกำหนด amount
, currency
, และ type
Parameter | Type | Description |
---|---|---|
amount |
integer | (required) ดู ข้อจำกัด |
currency |
string | (required) THB |
type |
string | (required) installment_paynext_extra_qr |
promotion_code |
string | (optional) promotion code ที่ TrueMoney กำหนด |
ตัวอย่างด้านล่างนี้เป็นการสร้าง source สำหรับรายการ PayNext Extra Installment QR จำนวน ฿4,000
ให้แทนค่าของ omise_public_key
และ $OMISE_PUBLIC_KEY
ด้วย test public key ของร้านค้าซึ่งสามารถคัดลอกได้จาก แดชบอร์ด
หากใช้ Omise.js parameter
type
เป็นตัวแปรที่จำเป็นของฟังก์ชันcreateSource
Omise.setPublicKey(omise_public_key);
Omise.createSource('installment_paynext_extra_qr', {
"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=installment_paynext_extra_qr"
{
"object": "source",
"id": "src_test_601oy4nefah01ei3php",
"livemode": false,
"location": "/sources/src_test_601oy4nefah01ei3php",
"amount": 400000,
"barcode": null,
"bank": null,
"created_at": "2024-06-11T01:52:43Z",
"currency": "THB",
"email": null,
"flow": "offline",
"installment_term": null,
"ip": "35.198.236.178",
"absorption_type": null,
"name": null,
"mobile_number": null,
"phone_number": null,
"platform_type": null,
"scannable_code": null,
"billing": null,
"shipping": null,
"items": [],
"references": null,
"provider_references": null,
"store_id": null,
"store_name": null,
"terminal_id": null,
"type": "installment_paynext_extra_qr",
"zero_interest_installments": null,
"charge_status": "unknown",
"receipt_amount": null,
"discounts": [],
"promotion_code": null
}
ตัวแปรของ id
คือ source identifier (เริ่มต้นด้วย src
)
การสร้างรายการรับชำระเงิน
สร้างรายการรับชำระเงินโดยระบุ parameter source
, amount
และ currency
source
จะเป็นตัวกำหนด source identifieramount
และ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 "return_uri=http://example.com/orders/345678/complete" \
-d "source=$SOURCE_ID"
{
"object": "charge",
"id": "chrg_test_601oy4q9m73xtd6b43y",
"location": "/charges/chrg_test_601oy4q9m73xtd6b43y",
"amount": 400000,
"acquirer_reference_number": null,
"net": 384378,
"fee": 14600,
"fee_vat": 1022,
"interest": 0,
"interest_vat": 0,
"funding_amount": 400000,
"refunded_amount": 0,
"transaction_fees": {
"fee_flat": "0.0",
"fee_rate": "3.65",
"vat_rate": "7.0"
},
"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_601oy4q9m73xtd6b43y/refunds",
"order": "chronological",
"from": "1970-01-01T00:00:00Z",
"to": "2024-06-11T01:52:44Z"
},
"link": null,
"description": null,
"metadata": {},
"card": null,
"source": {
"object": "source",
"id": "src_test_601oy4ct3a9pwfikdc5",
"livemode": false,
"location": "/sources/src_test_601oy4ct3a9pwfikdc5",
"amount": 400000,
"barcode": null,
"bank": null,
"created_at": "2024-06-11T01:52:42Z",
"currency": "THB",
"email": null,
"flow": "offline",
"installment_term": null,
"ip": "35.198.236.178",
"absorption_type": null,
"name": null,
"mobile_number": null,
"phone_number": null,
"platform_type": null,
"scannable_code": {
"object": "barcode",
"type": "qr",
"image": {
"object": "document",
"livemode": false,
"id": "docu_test_601oy4s5rmpuui7n0bu",
"deleted": false,
"filename": "qrcode.png",
"location": "/charges/chrg_test_601oy4q9m73xtd6b43y/documents/docu_test_601oy4s5rmpuui7n0bu",
"kind": "qr",
"download_uri": "https://api.omise.co/charges/chrg_test_601oy4q9m73xtd6b43y/documents/docu_test_601oy4s5rmpuui7n0bu/downloads/BD55AC91FD621F23",
"created_at": "2024-06-11T01:52:44Z"
}
},
"billing": null,
"shipping": null,
"items": [],
"references": null,
"provider_references": {
"reference_number_1": "pay2_test_601oy4qb8ntoqyokojm",
"reference_number_2": null
},
"store_id": null,
"store_name": null,
"terminal_id": null,
"type": "installment_paynext_extra_qr",
"zero_interest_installments": null,
"charge_status": "pending",
"receipt_amount": null,
"discounts": [],
"promotion_code": null
},
"schedule": null,
"linked_account": null,
"customer": null,
"dispute": null,
"transaction": null,
"failure_code": null,
"failure_message": null,
"status": "pending",
"authorize_uri": "https://pay.omise.co/payments/pay2_test_601oy4qb8ntoqyokojm/authorize",
"return_uri": "http://example.com/orders/345678/complete",
"created_at": "2024-06-11T01:52:44Z",
"paid_at": null,
"expires_at": "2024-06-12T01:52:44Z",
"expired_at": null,
"reversed_at": null,
"zero_interest_installments": false,
"branch": null,
"terminal": null,
"device": null,
"authorized": false,
"capturable": false,
"capture": true,
"disputable": false,
"livemode": false,
"refundable": false,
"partially_refundable": false,
"reversed": false,
"reversible": false,
"voided": false,
"paid": false,
"expired": false,
"can_perform_void": false,
"approval_code": null
}
การสร้าง source และรายการรับชำระเงิน
ร้านค้าสามารถสร้างทั้ง source และ รายการรับชำระเงิน (charge) ผ่านการเรียกใช้ API เพียงครั้งเดียว
curl https://api.omise.co/charges \
-u $OMISE_SECRET_KEY: \
-d "amount=400000" \
-d "currency=THB" \
-d "return_uri=http://example.com/orders/345678/complete" \
-d "source[type]=installment_paynext_extra_qr" \
สร้างรายการสำเร็จ
เมื่อร้านค้าสร้างรายการรับชำระเงินขึ้นมาแล้ว จะพบว่าสถานะของรายการแสดงเป็น pending
หรือ status==pending
โดยสถานะของรายการรับชำระเงินสามารถเป็นได้ทั้ง successful
, failed
และ expired
ในส่วนต่อไปเราจะอธิบายวิธีอนุมัติรายการ, การรับ event แจ้งเตือนเมื่อรายการเสร็จสิ้นผ่าน webhook และการตรวจสอบสถานะรายการ
ภาพด้านล่างนี้แสดงให้เห็นถึงขั้นตอนทั้งหมดในการรับชำระเงินแต่ละรายการ
การอนุมัติรายการรับชำระเงิน
ร้านค้าจะต้องแสดงคิวอาร์โค้ดให้กับผู้ซื้อ เพื่อสร้างรายการรับชำระเงิน จากนั้นให้ลูกค้าสแกนคิวอาร์โค้ดด้วยโทรศัพท์มือถือ เพื่ออนุมัติรายการรับชำระเงิน
ทั้งนี้ ร้านค้าสามารถจำลองขั้นตอนการอนุมัติรายการในโหมดทดสอบ โดยเข้าไปที่แดชบอร์ด แล้วคลิกเลือก Actions
เพื่อปรับสถานะรายการเป็น Successful
หรือ Failed
ได้ด้วยตนเอง
ค้นหาคิวอาร์โค้ดที่อยู่ในรายการรับชำระเงิน ดังนี้
charge:
source:
scannable_code:
image:
download_uri: QR code image to present to the customer
{
"object": "barcode",
"type": "qr",
"image": {
"object": "document",
"livemode": false,
"id": "docu_test_601oy4gxsgo1an7kl16",
"deleted": false,
"filename": "qrcode.png",
"location": "/charges/chrg_test_601oy4f6rf5pgx5lxea/documents/docu_test_601oy4gxsgo1an7kl16",
"kind": "qr",
"download_uri": "https://api.omise.co/charges/chrg_test_601oy4f6rf5pgx5lxea/documents/docu_test_601oy4gxsgo1an7kl16/downloads/30E29D8AB28D7A3B",
"created_at": "2024-06-11T01:52:42Z"
}
}
การรับ 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 เพื่ออ่านคำอธิบายเพิ่มเติม
สาเหตุขัดข้องที่อาจเกิดขึ้นได้มีดังนี้
รหัสข้อขัดข้อง | รายละเอียด |
---|---|
failed_processing |
ระบบทำรายการไม่สำเร็จ |
การยกเลิกรายการและการคืนเงิน
รายการรับชำระเงิน PayNext Extra Installment QR สามารถยกเลิกรายการ (void) ได้ภายในวันเดียวกับที่ทำรายการ และสามารถทำการคืนเงิน (refund) ได้ภายใน 30 วัน
สามารถอ่านวิธีการคืนเงินสำหรับรายการรับชำระเงินผ่าน PayNext Extra Installment QR ได้ที่ Refunds API
ข้อจำกัด
- จำนวนรับชำระขั้นต่ำ:
100000
(THB1,000.00) - จำนวนรับชำระสูงสุด:
15000000
(THB150,000.00)