決済
ホテルがオンライン予約で受け付ける支払い方法を一覧表示し、選択された方法に応じて決済ステップを開始します。方法ごとの処理は決済フローガイドで説明しています。
/external/online/payment/type支払い方法の一覧GET/external/payment/companyバーチャル POS 情報POST/external/online/payment/type/{paymentType}決済ステップを開始支払い方法の一覧#
/external/online/payment/type認証: Authorization: Bearer
ホテルがオンライン販売用に有効化した支払い方法を返します。タイプ ID は固定です:1 現地払い、3 銀行振込、9 クレジットカード(カード情報は予約と一緒に送信)、10 オンライン決済(バーチャル 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
}
]
}バーチャル POS 情報#
/external/payment/company認証: Authorization: Bearer
ホテルのバーチャル POS プロバイダーと加盟店情報を返します。プロバイダーと自社側で直接連携する場合にのみ必要です。標準のフローでは POST …/payment/type/10 を使用します。レスポンスには機密情報が含まれるため、サーバー側でのみ扱ってください。
クエリパラメーター
hotelIDinteger必須レスポンス
200 成功。
エラーレスポンス
- 200
hotel_company_info_could_not_found— ホテルにバーチャル 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": "ジラート銀行",
"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"
}