본문으로 건너뛰기

빠른 시작

테스트 키 발급부터 예약 홀드, 웹훅 수신까지 다섯 단계로 진행합니다.

이 페이지의 내용

1. 테스트 키 만들기

관리 화면에서 «개발자»를 열고 «테스트» 모드로 바꾼 뒤 읽기 전용 키를 만드세요. 키는 한 번만 표시되니 바로 복사해 API_KEY 환경 변수에 보관하세요.

2. 키 확인하기

GET /me는 계정, 키의 모드와 권한 범위를 돌려줍니다. 이것이 되면 나머지도 됩니다.

bash
curl "https://api.opentourbase.com/api/supplier/v1/me" \
  -H "Authorization: Bearer $API_KEY"
json
{
  "data": {
    "key": {
      "id": "ush_test_Ab12Cd34Ef56Gh78Ij90Kl12",
      "label": "Website back-end",
      "mode": "test",
      "scopes": [
        "products:read",
        "events:read"
      ]
    },
    "supplier": {
      "id": "0b0f6a0e-5a57-4a10-9f6c-2f7f7a5d3c11",
      "name": "Aurora Tours",
      "currency": "GEL",
      "currencyPrecision": 2,
      "timeZone": "Asia/Tbilisi"
    }
  }
}

3. 상품 목록 보기

테스트 키는 실제 카탈로그, 잔여석, 가격을 읽으므로 판매할 그대로를 보게 됩니다.

bash
curl "https://api.opentourbase.com/api/supplier/v1/products?limit=25" \
  -H "Authorization: Bearer $API_KEY"

4. 테스트 예약 홀드 후 확정하기

출발 회차를 찾아 자리를 홀드한 다음 확정합니다. 이때 키에 bookings:write 권한이 필요하니 전체 권한을 주거나 이 권한을 추가하세요. 테스트 예약은 결제가 일어나지 않고 고객에게 알림도 가지 않습니다.

bash
curl "https://api.opentourbase.com/api/supplier/v1/options/{optionUuid}/availability?local_date=2026-12-05" \
  -H "Authorization: Bearer $API_KEY"
bash
curl -X POST "https://api.opentourbase.com/api/supplier/v1/bookings" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"optionId":"{optionId}","availabilityId":"{availabilityId}","units":[{"unitId":"{unitId}","quantity":2}],"reference":"ORDER-1042"}'
bash
curl -X POST "https://api.opentourbase.com/api/supplier/v1/bookings/{uuid}/confirm" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"contact":{"fullName":"Ana Beridze","email":"ana@example.com"},"payment":{"mode":"offline"}}'

5. 웹훅 받기

«개발자 › 웹훅»에서 엔드포인트를 추가하고 «테스트 이벤트 보내기»를 누르세요. 1초 안에 서명된 요청이 서버에 도착합니다. 믿기 전에 서명을 확인하세요.

javascript
import crypto from "node:crypto";

export function verify(rawBody, headers, secret, toleranceSec = 300) {
  const id = headers["webhook-id"], ts = headers["webhook-timestamp"], sig = headers["webhook-signature"];
  if (!id || !ts || !sig || Math.abs(Date.now() / 1000 - Number(ts)) > toleranceSec) return false;
  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const expected = crypto.createHmac("sha256", key).update(`${id}.${ts}.${rawBody}`).digest("base64");
  return sig.split(" ").some((p) => {
    const [v, s] = p.split(",");
    return v === "v1" && s && s.length === expected.length && crypto.timingSafeEqual(Buffer.from(s), Buffer.from(expected));
  });
}
다음인증
요금무료로 시작하기