ใหม่ PayNext Extra Installment App Redirection
หัวข้อทั้งหมดในหน้านี้
เพิ่มตัวเลือกการรับชำระเงินสำหรับลูกค้าที่ต้องการชำระเงินผ่าน TrueMoney ด้วย PayNext Extra Installment บนเว็บไซต์ของคุณ
โดยในคู่มือแนะนำการใช้งานนี้จะอธิบายขั้นตอนการชำระเงิน และรายละเอียดวิธีการเปิดรับชำระเงินผ่าน TrueMoney ด้วย PayNext Extra Installment App Redirection
การเปิดรับชำระเงิน
- ประเทศที่รองรับ: ประเทศไทย
- API เวอร์ชันล่าสุดที่รองรับ:
2017-11-02
ร้านค้าที่ต้องการเปิดใช้ระบบ PayNext Extra Installment App Redirection กรุณาส่งอีเมลมาที่ support@opn.ooo ทางทีมงานโอเพ่นจะส่งข้อกำหนดและเงื่อนไขการใช้บริการให้ร้านค้าได้พิจารณาและลงลายมือชื่อก่อนเปิดใช้งานจริง
ขั้นตอนการชำระเงิน
การผ่อนชำระ PayNext Extra Installment App Redirection รองรับการชำระเงินผ่านแอปพลิเคชันมือถือและเว็บไซต์ โดยขั้นตอนการชำระเงินผ่าน PayNext Extra Installment App Redirection จะเป็นแบบ app_redirect ซึ่งหมายความว่า ระบบจะนำผู้ซื้อออกจากเว็บไซต์หรือแอปพลิเคชันของร้านค้าไปยังหน้าชำระเงินที่ปลอดภัยของ TrueMoney เพื่อให้ผู้ซื้ออนุมัติและยืนยันการทำรายการ และหากผู้ซื้อไม่ดำเนินการสแกนภายใน 3 นาที การชำระเงินนั้นจะหมดอายุลง
โดยตัวอย่างภาพหน้าจอนี้จะแสดงขั้นตอนการชำระเงิน ซึ่งผู้ซื้อสามารถเลือกระยะเวลาในการผ่อนชำระและอัตราดอกเบี้ยได้
การชำระเงินผ่านเบราว์เซอร์บนมือถือ
❶ ผู้ซื้อเลือก PayNext Extra Installment เป็นวิธีการชำระเงินบนเว็บไซต์หรือแอฟพลิเคชันของร้านค้า ❷ ระบบส่งผู้ซื้อไปยังแอป TrueMoney Wallet และลงชื่อเข้าใช้ ❸ หลังจากนั้น ผู้ซื้อเลือกระยะเวลาผ่อนชำระและอัตราดอกเบี้ย ❹ ระบบจะแสดงข้อมูลการชำระเงินให้ผู้ซื้อ ก่อนยืนยันการทำรายการ ❺ ผู้ซื้อยืนยันการทำรายการ ❻ เมื่อชำระเงินสำเร็จ ระบบจะแสดงสลิปยืนยันการทำรายการ
การชำระเงินผ่านเบราว์เซอร์บนคอมพิวเตอร์
❶ ระบบจะแสดงคิวอาร์โค้ดเมื่อผู้ซื้อเลือก PayNext Extra Installment เป็นวิธีการชำระเงินบนเว็บไซต์หรือแอฟพลิเคชันของร้านค้า ❷ ผู้ซื้อเปิดแอป TrueMoney Wallet ❸ ผู้ซื้อเปิดใช้ที่สแกนคิวอาร์จากในแอปพลิเคชัน ❹ จากนั้น ผู้ซื้อจะสแกนคิวอาร์โค้ดในหน้าเบราว์เซอร์บนคอมพิวเตอร์ ❺ ระบบส่งผู้ซื้อไปอีกหน้าหนึ่งเพื่อเลือกระยะเวลาผ่อนชำระและอัตราดอกเบี้ย ❻ ระบบจะแสดงข้อมูลการชำระเงินให้ผู้ซื้อเพื่อตรวจสอบ ❼ เมื่อตรวจสอบแล้ว ผู้ซื้อจะต้องยืนยันการทำรายการในหน้ายืนยัน ❽ เมื่อชำระเงินสำเร็จ ระบบจะแสดงสลิปยืนยันการทำรายการ
การติดตั้งใช้งาน
ในการสร้างรายการรับชำระเงินผ่านPayNext Extra Installment App Redirection ให้ร้านค้าส่งคำสั่ง API ดังนี้
- สร้าง payment source (
type
:installment_paynext_extra_jumpapp
) โดยใช้ Omise.js, omise-ios หรือ omise-android - สร้าง charge โดยใช้ source จากขั้นตอนแรก
- เมื่อผู้ซื้อทำรายการสำเร็จและร้านค้าได้รับ webhook event หรือ
charge.complete
แล้ว เราแนะนำให้ตรวจสอบสถานะรายการด้วยตนเองอีกครั้งเพื่อความแม่นยำ
การสร้าง source เพื่อรับชำระเงินผ่านPayNext Extra Installment App Redirection จะเกิดขึ้นในฝั่งของผู้ซื้อ (client-side) เช่นบนเว็บไซต์หรือโทรศัพท์มือถือของผู้ซื้อ ร้านค้าจะต้องใช้ public key
ส่วนการสร้างรายการ (charge) เพื่อรับชำระเงินผ่านPayNext Extra Installment App Redirection จะเกิดขึ้นในฝั่งของร้านค้า (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_jumpapp |
promotion_code |
string | (optional) promotion code ที่ TrueMoney กำหนด |
ตัวอย่างด้านล่างนี้เป็นการสร้าง source สำหรับรายการ PayNext Extra Installment App Redirection จำนวน ฿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_jumpapp', {
"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_jumpapp"
{
"object": "source",
"id": "src_test_601oyutapcvr4sypq6x",
"livemode": false,
"location": "/sources/src_test_601oyutapcvr4sypq6x",
"amount": 400000,
"barcode": null,
"bank": null,
"created_at": "2024-06-11T01:54:47Z",
"currency": "THB",
"email": null,
"flow": "app_redirect",
"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_jumpapp",
"zero_interest_installments": null,
"charge_status": "unknown",
"receipt_amount": null,
"discounts": [],
"promotion_code": null
}
ตัวแปรของ id
คือ source identifier (เริ่มต้นด้วย src
)
การสร้างรายการรับชำระเงิน
สร้างรายการรับชำระเงินโดยระบุ parameter return_uri
, source
, amount
และ currency
return_uri
จะเป็นตำแหน่งบนเว็บไซต์ของร้านค้าที่ผู้ซื้อจะถูกส่งไปเมื่อยืนยันรายการสำเร็จ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_601oyuz58wm9lckewe8",
"location": "/charges/chrg_test_601oyuz58wm9lckewe8",
"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_601oyuz58wm9lckewe8/refunds",
"order": "chronological",
"from": "1970-01-01T00:00:00Z",
"to": "2024-06-11T01:54:48Z"
},
"link": null,
"description": null,
"metadata": {},
"card": null,
"source": {
"object": "source",
"id": "src_test_601oyudatqxn5xc1j0m",
"livemode": false,
"location": "/sources/src_test_601oyudatqxn5xc1j0m",
"amount": 400000,
"barcode": null,
"bank": null,
"created_at": "2024-06-11T01:54:45Z",
"currency": "THB",
"email": null,
"flow": "app_redirect",
"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": {
"reference_number_1": "4Nv0QvT7N2N2Z8EB",
"reference_number_2": null
},
"store_id": null,
"store_name": null,
"terminal_id": null,
"type": "installment_paynext_extra_jumpapp",
"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_601oyv02m7l1t7mox7s/authorize",
"return_uri": "http://example.com/orders/345678/complete",
"created_at": "2024-06-11T01:54:48Z",
"paid_at": null,
"expires_at": "2024-06-18T01:54:48Z",
"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_jumpapp" \
สร้างรายการสำเร็จ
เมื่อร้านค้าสร้างรายการรับชำระเงินขึ้นมาแล้ว จะพบว่าสถานะของรายการแสดงเป็น pending
หรือ status==pending
โดยสถานะของรายการรับชำระเงินสามารถเป็นได้ทั้ง successful
, failed
และ expired
ในส่วนต่อไปเราจะอธิบายวิธีอนุมัติรายการ, การรับ event แจ้งเตือนเมื่อรายการเสร็จสิ้นผ่าน webhook และการตรวจสอบสถานะรายการ
ภาพด้านล่างนี้แสดงให้เห็นถึงขั้นตอนทั้งหมดในการรับชำระเงินแต่ละรายการ
การอนุมัติรายการรับชำระเงิน
ระบบจะส่งผู้ซื้อไปยังตำแหน่งที่ระบุไว้ใน authorize_uri
เพื่อให้ผู้ซื้อสามารถดำเนินการอนุมัติรายการรับชำระเงินได้
ร้านค้าสามารถจำลองขั้นตอนการอนุมัติรายการในโหมดทดสอบ โดยเข้าไปที่ authorize_uri
เพื่อปรับสถานะรายการเป็น “สำเร็จ” หรือ “ไม่สำเร็จ” ได้ด้วยตนเอง หลังจากผู้ซื้อทำการอนุมัติรายการเสร็จสิ้น ผู้ซื้อจะถูกส่งไปยังหน้าที่ร้านค้าระบุเป็น return_uri
เอาไว้
การรับ 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 สามารถยกเลิกรายการ (void) ได้ภายในวันเดียวกับที่ทำรายการ และสามารถทำการคืนเงิน (refund) ได้ภายใน 30 วัน
สามารถอ่านวิธีการคืนเงินสำหรับรายการรับชำระเงินผ่าน PayNext Extra Installment ได้ที่ Refunds API
ข้อจำกัด
- จำนวนรับชำระขั้นต่ำ:
100000
(THB1,000.00) - จำนวนรับชำระสูงสุด:
15000000
(THB150,000.00)