Pago
Lista los tipos de pago que el hotel acepta en las reservas online e inicia el paso de pago para el tipo seleccionado. Qué hacer con cada tipo se explica en la guía Flujo de pago.
/external/online/payment/typeListar tipos de pagoGET/external/payment/companyDatos del POS virtualPOST/external/online/payment/type/{paymentType}Iniciar el paso de pagoListar tipos de pago#
/external/online/payment/typeAutenticación: Authorization: Bearer
Devuelve los tipos de pago que el hotel ha habilitado para la venta online. IDs de tipo fijos: 1 pago en el hotel, 3 transferencia bancaria, 9 tarjeta de crédito (los datos de la tarjeta se envían con la reserva), 10 pago online (POS virtual).
Parámetros de consulta
hotelIDintegerobligatorioRespuesta
200 Operación correcta.
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": "Pago en el hotel",
"title_translate": "odeme.otelde_odeme",
"typeID": 1
},
{
"title": "Transferencia bancaria",
"title_translate": "odeme.havale",
"typeID": 3
},
{
"title": "Pago online con tarjeta",
"title_translate": "odeme.online_odeme",
"typeID": 10
}
]
}Datos del POS virtual#
/external/payment/companyAutenticación: Authorization: Bearer
Devuelve el proveedor de POS virtual del hotel y los datos del comercio. Solo lo necesitas si integras el proveedor directamente en tu sistema; el flujo estándar usa POST …/payment/type/10. La respuesta contiene datos secretos; no la saques del servidor.
Parámetros de consulta
hotelIDintegerobligatorioRespuesta
200 Operación correcta.
Respuestas de error
- 200
hotel_company_info_could_not_found— el hotel no tiene ningún POS virtual configurado.
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"
}
}Iniciar el paso de pago#
/external/online/payment/type/{paymentType}Autenticación: Authorization: Bearer · Cuerpo: application/json
Devuelve qué hacer según el tipo de pago seleccionado. Los tipos 1 y 9 solo necesitan hotelID; el tipo 3 lista las cuentas bancarias; con el tipo 10, el pago se inicia con los datos del huésped y de la cesta, y el code (HTML) devuelto se muestra en la página del huésped para pasar a la pantalla de pago del proveedor.
Parámetros de ruta
paymentTypeintegerobligatorio13910Cuerpo de la solicitud
hotelIDintegerobligatoriototalPricedecimalorderIDstringreturnUrlstringname / surname / email / phonestringcity / addressstringcountryIDintegerid de la lista de países.baskets[]object[]id, name, piece, price.Respuesta
200 Tipo 10: code contiene un fragmento HTML que redirige al proveedor de pago (un formulario que se envía automáticamente, un script window.location o un formulario de pago integrado, según el proveedor). Muéstralo tal cual en el navegador del huésped. Con los demás tipos, el campo message indica qué hacer.
Respuestas de error
- 200
required_input_info_not_submitted(+errors[]) — falta un campo para el tipo 10;country_info_sent_incorrectly—countryIDno válido;there_is_missing_info_in_the_shopping_cart— falta un campo en un elemento de la cesta;bank_info_is_not_found— no hay ninguna cuenta bancaria configurada para el tipo 3. - 404
paymentTypedesconocido.
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": "Habitación Estándar · Alojamiento y desayuno",
"piece": 1,
"price": 1930
},
{
"id": 12,
"name": "Cena",
"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": "Habitación Estándar · Alojamiento y desayuno",
"piece": 1,
"price": 1930
},
{
"id": 12,
"name": "Cena",
"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' => 'Habitación Estándar · Alojamiento y desayuno',
'piece' => 1,
'price' => 1930,
],
[
'id' => 12,
'name' => 'Cena',
'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 Bank",
"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"
}