Paiement
Liste les types de paiement acceptés par l’hôtel pour les réservations en ligne et lance l’étape de paiement pour le type choisi. La marche à suivre pour chaque type est décrite dans le guide Flux de paiement.
/external/online/payment/typeLister les types de paiementGET/external/payment/companyInformations du TPE virtuelPOST/external/online/payment/type/{paymentType}Lancer l’étape de paiementLister les types de paiement#
/external/online/payment/typeAuthentification: Authorization: Bearer
Renvoie les types de paiement activés par l’hôtel pour la vente en ligne. Identifiants de type fixes : 1 paiement à l’hôtel, 3 virement bancaire, 9 carte de crédit (données de carte envoyées avec la réservation), 10 paiement en ligne (TPE virtuel).
Paramètres de requête
hotelIDintegerobligatoireRéponse
200 Succès.
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": "Paiement à l’hôtel",
"title_translate": "odeme.otelde_odeme",
"typeID": 1
},
{
"title": "Virement bancaire",
"title_translate": "odeme.havale",
"typeID": 3
},
{
"title": "Paiement en ligne par carte",
"title_translate": "odeme.online_odeme",
"typeID": 10
}
]
}Informations du TPE virtuel#
/external/payment/companyAuthentification: Authorization: Bearer
Renvoie le prestataire de TPE virtuel de l’hôtel et les informations du compte marchand. Nécessaire uniquement si vous intégrez directement le prestataire de votre côté ; le flux standard utilise POST …/payment/type/10. La réponse contient des secrets : conservez-la côté serveur.
Paramètres de requête
hotelIDintegerobligatoireRéponse
200 Succès.
Réponses d’erreur
- 200
hotel_company_info_could_not_found— aucun TPE virtuel configuré pour l’hôtel.
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"
}
}Lancer l’étape de paiement#
/external/online/payment/type/{paymentType}Authentification: Authorization: Bearer · Corps: application/json
Renvoie la marche à suivre pour le type de paiement choisi. Les types 1 et 9 ne nécessitent que hotelID ; le type 3 liste les comptes bancaires ; pour le type 10, le paiement est lancé avec les informations du client et du panier, et le code (HTML) renvoyé est affiché sur la page du client pour passer la main à l’écran de paiement du prestataire.
Paramètres de chemin
paymentTypeintegerobligatoire13910Corps de la requête
hotelIDintegerobligatoiretotalPricedecimalorderIDstringreturnUrlstringname / surname / email / phonestringcity / addressstringcountryIDintegerid issu de la liste des pays.baskets[]object[]id, name, piece, price.Réponse
200 Type 10 : code contient un fragment HTML qui passe la main au prestataire de paiement (formulaire à soumission automatique, script window.location ou formulaire de paiement intégré, selon le prestataire). Affichez-le tel quel dans le navigateur du client. Pour les autres types, le champ message indique la marche à suivre.
Réponses d’erreur
- 200
required_input_info_not_submitted(+errors[]) — champ manquant pour le type 10 ;country_info_sent_incorrectly—countryIDinvalide ;there_is_missing_info_in_the_shopping_cart— champ manquant dans un élément du panier ;bank_info_is_not_found— aucun compte bancaire configuré pour le type 3. - 404
paymentTypeinconnu.
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": "Chambre standard · Petit-déjeuner inclus",
"piece": 1,
"price": 1930
},
{
"id": 12,
"name": "Dîner",
"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": "Chambre standard · Petit-déjeuner inclus",
"piece": 1,
"price": 1930
},
{
"id": 12,
"name": "Dîner",
"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' => 'Chambre standard · Petit-déjeuner inclus',
'piece' => 1,
'price' => 1930,
],
[
'id' => 12,
'name' => 'Dîner',
'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"
}