คู่มือการเชื่อมระบบ EasyZone Radius Billing กับ Cloudbeds API

From EasyZone wiki
Revision as of 11:54, 21 March 2024 by Easyhorpak (talk | contribs)
Jump to: navigation, search

มีวิธีการดังต่อไปนี้

1. ให้ admin cloudbeds ของโรงแรมสร้าง client_id client_secret api_key ส่วนค่า redirect_uri ตั้งเป็น https://www.cloud-hotspot.com/page/ โดยเลือก permission เป็น read ในระบบและส่งให้ทีมงาน easyzone

2. ให้ admin cloudbeds login เพื่อตามค่า code ที่ url https://hotels.cloudbeds.com/api/v1.1/oauth?client_id=client_id&redirect_uri=https://www.cloud-hotspot.com/page/&response_type=code&scope=

ค่า client_id คือ ค่าที่ท่าน admin cloudbeds ส่งให้

หลังจากนั้นจะได้ url https://www.cloud-hotspot.com/page/?code=xxxx&state=xxxx

3. admin easyzone ทำการดึงค่า access token จาก curl scripts ดังนี้

code=xxxx

client_id=xxxx

client_secret=xxxx

api_key=xxxx

curl -d "code=$code&client_id=$client_id&client_secret=$client_secret&redirect_uri=https://www.cloud-hotspot.com/page/&grant_type=authorization_code" -H "Content-Type: application/x-www-form-urlencoded" -X POST https://hotels.cloudbeds.com/api/v1.1/access_token

ระบบจะแสดงข้อมูล access token และ refresh token

access_token="xxxx" refresh_token="xxxx"

4. ให้นำ access token มาทำการ add webhook ตามสคริปท์ ดังนี้