Billing Subscriptions

Attach a registered payment method to an existing subscription

구독이 쓸 결제수단을 지정한다 - 구독 생성과 같은 권한(OWNER · ADMIN 또는 운영자).

load -> idempotency begin(+replay) -> 지정 -> complete -> COMMIT 순서다. 권한 · 조직 격리는 구독 불러오기가 한다 (다른 조직의 구독은 404). 결제수단 검증(같은 조직 · ACTIVE · 청구 가능)은 서비스가 한다.

post/v1/subscriptions/{subscription_id}/payment-method

Request

  • Base URL: https://api.xdata.kr (the document declares no server; this is the origin it was published from)
  • URL: https://api.xdata.kr/v1/subscriptions/{subscription_id}/payment-method
  • Auth: one of:
    • HTTP basic
    • OAuth 2 (authorization code, authorization URL https://api.xdata.kr/oauth/authorize, token URL https://api.xdata.kr/oauth/token)

Path parameters

subscription_idinteger required

Query parameters

env_scope'production' | 'real_test' | 'sandbox' nullable

환경을 고릅니다. 값은 production · real_test · sandbox 중 하나입니다. 경로 접두(/v1/sandbox/... · /v1/test/... · /v1/production/...) · X-Env-Scope 헤더 · env_scope 쿼리 가운데 한 통로로 반드시 보내야 합니다. 빼면 자동으로 채우지 않고 거절하며, 두 통로에 서로 다른 값을 담아도 거절합니다. 거절은 HTTP 422 이고 오류 코드는 VALIDATION_ENV_SCOPE_MISMATCH 입니다.

Headers

Idempotency-Keystring required
Authorizationstring nullable
X-Env-Scope'production' | 'real_test' | 'sandbox' nullable

환경을 고릅니다. 값은 production · real_test · sandbox 중 하나입니다. 경로 접두(/v1/sandbox/... · /v1/test/... · /v1/production/...) · X-Env-Scope 헤더 · env_scope 쿼리 가운데 한 통로로 반드시 보내야 합니다. 빼면 자동으로 채우지 않고 거절하며, 두 통로에 서로 다른 값을 담아도 거절합니다. 거절은 HTTP 422 이고 오류 코드는 VALIDATION_ENV_SCOPE_MISMATCH 입니다.

Request body

payment_method_idinteger required

구독이 앞으로 쓸 결제수단 id. 같은 조직 · 같은 환경의 ACTIVE 이고 빌키로 청구할 수 있는 종류여야 한다.

Response

Successful Response

subscription_idinteger required

subscriptions.id.

organization_idinteger required

소유 조직 PK.

payment_method_idinteger nullable

활성 결제수단 ID. SCHEMA NULL 허용 (수동 청구 모드 가능).

status'PENDING' | 'ACTIVE' | 'PAUSED' | 'CANCELED' | 'EXPIRED' | 'PAYMENT_FAILED' required

구독 상태 (6값 enum).

env_scope'sandbox' | 'real_test' | 'production' required

환경 스코프.

current_period_startstring date-time nullable

현재 청구 기간 시작 (PENDING 시 NULL 가능).

current_period_endstring date-time nullable

현재 청구 기간 종료 (PENDING 시 NULL 가능).

next_billing_atstring date-time nullable

다음 자동 청구 시각 (PAUSED/CANCELED/EXPIRED 시 NULL).

grace_period_untilstring date-time nullable

결제 실패 유예 종료 시각 (PAYMENT_FAILED 상태에서 채워짐).

canceled_atstring date-time nullable

취소 시각 (CANCELED 진입 시 채워짐).

created_atstring date-time required

구독 생성 시각 (aware datetime, naive 입력 시 422).

Changes

No recorded changes to this operation across all 1 revision of this API.