การชำระเงิน
แสดงรายการประเภทการชำระเงินที่โรงแรมรับสำหรับการจองออนไลน์ และเริ่มขั้นตอนการชำระเงินสำหรับประเภทที่เลือก สิ่งที่ต้องทำในแต่ละประเภทอธิบายไว้ในคู่มือขั้นตอนการชำระเงิน
/external/online/payment/typeแสดงรายการประเภทการชำระเงินGET/external/payment/companyข้อมูล Virtual POSPOST/external/online/payment/type/{paymentType}เริ่มขั้นตอนการชำระเงินแสดงรายการประเภทการชำระเงิน#
/external/online/payment/typeการยืนยันตัวตน: Authorization: Bearer
ส่งคืนประเภทการชำระเงินที่โรงแรมเปิดใช้สำหรับการขายออนไลน์ ID ประเภทที่กำหนดตายตัว: 1 ชำระที่โรงแรม, 3 โอนเงินผ่านธนาคาร, 9 บัตรเครดิต (ส่งข้อมูลบัตรพร้อมการจอง), 10 ชำระเงินออนไลน์ (Virtual POS)
พารามิเตอร์คิวรี
hotelIDintegerจำเป็นการตอบกลับ
200 สำเร็จ
curl "https://test.hms.gen.tr/external/online/payment/type?hotelID=1000" \
-H "Authorization: Bearer $HMS_TOKEN"const res = await fetch("https://test.hms.gen.tr/external/online/payment/type?hotelID=1000", {
headers: {
"Authorization": `Bearer ${process.env.HMS_TOKEN}`
}
});
const data = await res.json();$ch = curl_init('https://test.hms.gen.tr/external/online/payment/type?hotelID=1000');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('HMS_TOKEN'),
],
]);
$data = json_decode(curl_exec($ch), true);{
"success": true,
"count": 3,
"items": [
{
"title": "ชำระที่โรงแรม",
"title_translate": "odeme.otelde_odeme",
"typeID": 1
},
{
"title": "โอนเงินผ่านธนาคาร",
"title_translate": "odeme.havale",
"typeID": 3
},
{
"title": "ชำระด้วยบัตรออนไลน์",
"title_translate": "odeme.online_odeme",
"typeID": 10
}
]
}ข้อมูล Virtual POS#
/external/payment/companyการยืนยันตัวตน: Authorization: Bearer
ส่งคืนผู้ให้บริการ Virtual POS และข้อมูลร้านค้า (merchant) ของโรงแรม จำเป็นเฉพาะเมื่อคุณเชื่อมต่อกับผู้ให้บริการโดยตรงจากฝั่งของคุณเท่านั้น ขั้นตอนมาตรฐานใช้ POST …/payment/type/10 การตอบกลับมีข้อมูลลับ จึงต้องเก็บไว้ฝั่งเซิร์ฟเวอร์
พารามิเตอร์คิวรี
hotelIDintegerจำเป็นการตอบกลับ
200 สำเร็จ
การตอบกลับเมื่อเกิดข้อผิดพลาด
- 200
hotel_company_info_could_not_found— โรงแรมยังไม่ได้ตั้งค่า Virtual POS
curl "https://test.hms.gen.tr/external/payment/company?hotelID=1000" \
-H "Authorization: Bearer $HMS_TOKEN"const res = await fetch("https://test.hms.gen.tr/external/payment/company?hotelID=1000", {
headers: {
"Authorization": `Bearer ${process.env.HMS_TOKEN}`
}
});
const data = await res.json();$ch = curl_init('https://test.hms.gen.tr/external/payment/company?hotelID=1000');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('HMS_TOKEN'),
],
]);
$data = json_decode(curl_exec($ch), true);{
"success": true,
"paymentCompany": {
"merchant_id": "4000****",
"store_key": "********",
"terminal_no": "VP00****",
"user": "demo_api",
"password": "********",
"max_installment": 6,
"company_id": 3,
"company_code": "iyzico",
"company_name": "iyzico"
}
}เริ่มขั้นตอนการชำระเงิน#
/external/online/payment/type/{paymentType}การยืนยันตัวตน: Authorization: Bearer · เนื้อหา: application/json
ส่งคืนสิ่งที่ต้องทำสำหรับประเภทการชำระเงินที่เลือก ประเภท 1 และ 9 ต้องการเพียง hotelID ประเภท 3 แสดงรายการบัญชีธนาคาร ส่วนประเภท 10 จะเริ่มการชำระเงินด้วยข้อมูลผู้เข้าพักและตะกร้าสินค้า แล้วนำ code (HTML) ที่ส่งกลับมาไปแสดงบนหน้าเว็บของผู้เข้าพักเพื่อส่งต่อไปยังหน้าชำระเงินของผู้ให้บริการ
พารามิเตอร์พาธ
paymentTypeintegerจำเป็น13910เนื้อหาคำขอ
hotelIDintegerจำเป็นtotalPricedecimalorderIDstringreturnUrlstringname / surname / email / phonestringcity / addressstringcountryIDintegerid จากรายการประเทศbaskets[]object[]id, name, piece, priceการตอบกลับ
200 ประเภท 10: code มีส่วนย่อย HTML ที่ส่งต่อไปยังผู้ให้บริการชำระเงิน (ฟอร์มที่ส่งอัตโนมัติ สคริปต์ window.location หรือฟอร์มชำระเงินแบบฝัง ขึ้นอยู่กับผู้ให้บริการ) ให้แสดงผลตามที่ได้รับในเบราว์เซอร์ของผู้เข้าพัก สำหรับประเภทอื่น ฟิลด์ message จะบอกสิ่งที่ต้องทำ
การตอบกลับเมื่อเกิดข้อผิดพลาด
- 200
required_input_info_not_submitted(+errors[]) — ขาดฟิลด์สำหรับประเภท 10;country_info_sent_incorrectly—countryIDไม่ถูกต้อง;there_is_missing_info_in_the_shopping_cart— รายการในตะกร้าขาดฟิลด์;bank_info_is_not_found— ไม่ได้ตั้งค่าบัญชีธนาคารสำหรับประเภท 3 - 404
paymentTypeที่ไม่รู้จัก
curl -X POST "https://test.hms.gen.tr/external/online/payment/type/10" \
-H "Authorization: Bearer $HMS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"hotelID": 1000,
"totalPrice": 2330,
"orderID": "4811174883",
"returnUrl": "https://booking.example.com/payment/result",
"name": "Ayşe",
"surname": "Demir",
"email": "[email protected]",
"phone": "05551112233",
"city": "Denizli",
"address": "Kumsal Cad. No: 12",
"countryID": 1,
"baskets": [
{
"id": 2,
"name": "ห้องสแตนดาร์ด · รวมอาหารเช้า",
"piece": 1,
"price": 1930
},
{
"id": 12,
"name": "อาหารเย็น",
"piece": 1,
"price": 400
}
]
}'const res = await fetch("https://test.hms.gen.tr/external/online/payment/type/10", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.HMS_TOKEN}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"hotelID": 1000,
"totalPrice": 2330,
"orderID": "4811174883",
"returnUrl": "https://booking.example.com/payment/result",
"name": "Ayşe",
"surname": "Demir",
"email": "[email protected]",
"phone": "05551112233",
"city": "Denizli",
"address": "Kumsal Cad. No: 12",
"countryID": 1,
"baskets": [
{
"id": 2,
"name": "ห้องสแตนดาร์ด · รวมอาหารเช้า",
"piece": 1,
"price": 1930
},
{
"id": 12,
"name": "อาหารเย็น",
"piece": 1,
"price": 400
}
]
})
});
const data = await res.json();$ch = curl_init('https://test.hms.gen.tr/external/online/payment/type/10');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('HMS_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'hotelID' => 1000,
'totalPrice' => 2330,
'orderID' => '4811174883',
'returnUrl' => 'https://booking.example.com/payment/result',
'name' => 'Ayşe',
'surname' => 'Demir',
'email' => '[email protected]',
'phone' => '05551112233',
'city' => 'Denizli',
'address' => 'Kumsal Cad. No: 12',
'countryID' => 1,
'baskets' => [
[
'id' => 2,
'name' => 'ห้องสแตนดาร์ด · รวมอาหารเช้า',
'piece' => 1,
'price' => 1930,
],
[
'id' => 12,
'name' => 'อาหารเย็น',
'piece' => 1,
'price' => 400,
],
],
]),
]);
$data = json_decode(curl_exec($ch), true);{
"success": true,
"message": "payment_order_code",
"code": "<form method=\"post\" action=\"https://vpos.provider.example/3d\"><input type=\"hidden\" name=\"orderId\" value=\"4811174883\"> … </form><script>document.forms[0].submit()</script>"
}{
"success": true,
"message": "payment_by_bank_transfer",
"banks": [
{
"companyName": "ธนาคาร Ziraat",
"holder": "Demo Turizm A.Ş.",
"branchName": "Denizli",
"branchNumber": "0123",
"bankAccountNumber": "12345678-5001",
"iban": "TR00 0001 0001 2345 6789 5001 01"
}
]
}{
"success": true,
"message": "credit_card_info_should_be_requested"
}