bootpaydevelopers
관리자

빌링키 조회

유효한 빌링키인지 조회합니다. 빌링키가 유효하지 않으면 결제를 요청할 수 없으며, 처음부터 다시 발급받아야 합니다.

조회 기준

상황조회 키다음 단계
프론트엔드 발급 직후receipt_idbilling_key를 DB에 저장
저장된 빌링키 상태 확인billing_key결제 요청 가능 여부 판단
카드 변경 후 새 빌링키 확인새 발급 receipt_id기존 빌링키 revoked, 새 빌링키 active

조회 응답의 카드/계좌 정보는 사용자 화면 표시용으로만 저장합니다.

receipt_id로 조회

빌링키 발급 시 받은 영수증 ID로 조회합니다. 이 엔드포인트는 발급 요청(Receipt) 기준으로 응답을 만듭니다.

요청 파라미터

파라미터타입필수설명
receipt_idStringY빌링키 발급 시 받은 영수증 ID (URL 파라미터)
GET/v2/subscribe/billing_key/:receipt_id
Base URLhttps://api.bootpay.co.kr
인증Basic Auth

billing_key로 조회

이미 발급받은 빌링키로 조회합니다. 이 엔드포인트는 빌링키(BillingKey) 기준으로 응답을 만듭니다.

요청 파라미터

파라미터타입필수설명
billing_keyStringY부트페이에서 부여한 빌링키 (URL 파라미터)

두 엔드포인트의 응답 차이

같은 빌링키를 가리키더라도 두 엔드포인트가 내려주는 필드는 서로 다릅니다.

항목receipt_id 조회billing_key 조회
기준발급 요청(Receipt)빌링키(BillingKey)
receipt_id있음없음
subscription_id있음없음
status_locale있음 ("빌링키발급완료")없음
status발급 진행 상태 — 11이 발급완료빌링키 사용 여부 — 1(사용가능) / 0(사용불가)
pg · method · method_symbol있음있음
method_origin · method_origin_symbol있음없음
version · revoked_at없음있음
sandboxAPI 버전 3부터만항상 있음
published_at있음있음
billing_key · billing_data · billing_expire_at있음있음
GET/v2/billing_key/:billing_key
Base URLhttps://api.bootpay.co.kr
인증Basic Auth

코드 예제

import { Bootpay } from '@bootpay/backend-js'

Bootpay.setConfiguration({
    client_key: '[ Client Key ]',
    secret_key: '[ Secret Key ]'
})

try {
    const response = await Bootpay.lookupSubscribeBillingKey(
        '[ receipt_id ]'
    )
    // billing_key를 데이터베이스에 저장
    console.log(response)
} catch (e) {
    console.log(e)
}

응답

빌링키 조회 응답의 status로 발급 상태를 확인합니다. receipt_id로 조회하면 status가 Number 11일 때 빌링키 발급이 완료된 상태입니다.

{
  "receipt_id": "6261104e1fc19202e6f9420e",
  "subscription_id": "sub_1705289520000",
  "gateway_url": "https://api.bootpay.co.kr/...",
  "metadata": {
    "user_id": "1234"
  },
  "pg": "나이스페이먼츠",
  "method": "카드자동",
  "method_symbol": "card_rebill",
  "method_origin": "카드자동",
  "method_origin_symbol": "card_rebill",
  "published_at": "2025-01-15T14:32:00+09:00",
  "requested_at": "2025-01-15T14:31:52+09:00",
  "status_locale": "빌링키발급완료",
  "status": 11,
  "billing_key": "615d00f0197c300036b4fef5",
  "billing_data": {
    "card_company": "하나카드",
    "card_no": "5570-****-****-1074",
    "card_company_code": "046",
    "card_type": 0,
    "card_hash": "f5b2a..."
  },
  "billing_expire_at": "2027-01-01T00:00:00+09:00"
}

응답 파라미터

파라미터타입설명
receipt_idString빌링키 발급 요청의 영수증 ID (receipt_id 조회에만 포함)
subscription_idString요청 시 넣은 가맹점 고유 구독 번호 (receipt_id 조회에만 포함)
pgStringPG사명
methodString결제수단명
method_symbolString결제수단 영문 심볼
method_originString원 결제수단명 (receipt_id 조회에만 포함)
method_origin_symbolString원 결제수단 영문 심볼 (receipt_id 조회에만 포함)
gateway_urlString게이트웨이 URL (receipt_id 조회에만 포함)
metadataObject요청 시 넣은 커스텀 데이터 (receipt_id 조회에만 포함)
requested_atDate발급 요청 시간 (ISO 8601, receipt_id 조회에만 포함)
published_atDate빌링키 발급 시간 (ISO 8601)
status_localeString빌링키 발급 상태 한글 ("빌링키발급완료", receipt_id 조회에만 포함)
statusNumberreceipt_id 조회: 발급 상태(11 = 발급완료) / billing_key 조회: 사용 여부(1 = 사용가능, 0 = 사용불가)
billing_keyString빌링키. 반드시 데이터베이스에 저장합니다
billing_dataObject빌링키와 연결된 카드/계좌 정보
billing_data.card_companyString카드사명 (자동카드결제)
billing_data.card_noString마스킹된 카드번호 (자동카드결제)
billing_data.card_company_codeStringPG사 정의 카드사 코드 (자동카드결제)
billing_data.card_typeNumber카드 종류 (0: 신용카드, 1: 체크카드)
billing_data.card_hashString카드번호 SHA-256 해시. KCP를 제외한 대부분의 PG(나이스페이먼츠·토스페이먼츠·이니시스·다날·웰컴페이먼츠·페이앱·키움페이·라이트페이)에서 전달됩니다
billing_data.bank_codeString은행코드 3자리 (자동계좌이체)
billing_data.bank_nameString은행명 (자동계좌이체)
billing_data.bank_accountString마스킹된 계좌번호 (자동계좌이체)
billing_data.usernameString계좌주명 (자동계좌이체)
billing_expire_atDate빌링키 만료일 (ISO 8601)
sandboxNumber샌드박스 여부 (billing_key 조회)
versionNumber빌링키 데이터 버전 (billing_key 조회에만 포함)
revoked_atDate빌링키 삭제 시각, 삭제 전이면 null (billing_key 조회에만 포함)
receipt_dataObject발급과 함께 결제까지 한 경우의 결제 정보 (receipt_id 조회, price > 0일 때만)

에러 코드

오류 코드

코드메시지대처 방법
RC_NOT_FOUND (2000)영수증 정보를 찾지 못했습니다receipt_id로 조회할 때 존재하지 않거나 다른 프로젝트의 영수증이면 SUBSCRIBE_BK_NOT_FOUND보다 먼저 이 코드가 나옵니다. receipt_id와 사용 중인 Application 키를 확인합니다
SUBSCRIBE_BK_NOT_FOUND (2309)빌링키 발급 내역을 찾지 못했습니다receipt_id 또는 billing_key가 올바른지 확인합니다
SUBSCRIBE_NOT_SUCCESS (2308)빌링키 발급이 완료된 건이 아니다빌링키 발급이 정상 완료되었는지 확인합니다
RC_NOT_SUBSCRIBE (2057)정기결제 요청 정보가 아니다정기결제 관련 영수증인지 확인합니다

함께 보기