# 계약 상세

원문: https://commerce.bootpay.ai/api/subscription-contract/detail

> 구독 계약 ID 로 계약 하나를 조회합니다. 구독 상태 · 수량 · 총 회차 · 서비스 시작일이 오고, 가맹점이 지정한 외부 ID 로도 찾을 수 있습니다.

[v1 API 상세 명세](https://commerce.bootpay.ai/api/reference/v1/order-subscriptions)

**구독 계약 ID**로 단일 계약의 상세 정보를 조회합니다. [계약 목록](https://commerce.bootpay.ai/api/subscription-contract/list)에서 얻은 `order_subscription_id`를 넣습니다.

## API 엔드포인트

::: endpoint
method: GET
url: https://api.bootapi.com/v1/order_subscriptions/:order_subscription_id
auth: [Basic Auth](https://commerce.bootpay.ai/api/server/authentication)
:::

::: warning 경로는 언더스코어입니다
`order_subscriptions` 는 언더스코어를 씁니다. 구독 API 중 하이픈을 쓰는 [신청 관리](https://commerce.bootpay.ai/api/subscription-contract/requests)의 `order-subscription-requests` 와 헷갈리지 않게 주의합니다.
:::

## 요청 파라미터

::: parameters

| 파라미터 | 타입 | 필수 | 설명 |
|---------|------|------|------|
| order_subscription_id | String | Y | 구독 계약 ID 또는 가맹점이 지정한 외부 ID (URL 경로) |

:::

## 코드 예제

::: code-group

```bash [cURL]
curl -X GET "https://api.bootapi.com/v1/order_subscriptions/687a1b2c3d4e5f6789012345" \
  -H "Authorization: Basic {base64(client_key:secret_key)}"
```

```java [Java]
import kr.co.bootpay.store.BootpayStore;
import kr.co.bootpay.store.model.request.TokenPayload;
import kr.co.bootpay.store.model.response.BootpayStoreResponse;

TokenPayload tp = new TokenPayload("your-commerce-client-key", "your-commerce-secret-key");
BootpayStore commerce = new BootpayStore(tp).withToken();

BootpayStoreResponse response = commerce.orderSubscription.detail("687a1b2c3d4e5f6789012345");
System.out.println(response);
```

```ruby [Ruby]
require 'bootpay'

commerce = BootpayStore::RestClient.new(client_key: 'your-commerce-client-key', secret_key: 'your-commerce-secret-key')
response = commerce.order_subscription_detail(order_subscription_id: '687a1b2c3d4e5f6789012345')
puts response.data
```

:::

## 응답

```json
{
  "order_subscription_id": "687a1b2c3d4e5f6789012345",
  "order_name": "Professional 플랜 구독",
  "status": "subscribing",
  "quantity": 2,
  "total_subscription_duration": 12,
  "service_start_at": "2025-08-01T00:00:00Z"
}
```

## 응답 파라미터

| 파라미터 | 타입 | 설명 |
|---------|------|------|
| order_subscription_id | String | 구독 계약 ID |
| order_name | String | 구독 상품명 |
| status | String | 구독 상태 — 아래 표 참고 |
| quantity | Integer | 수량 |
| total_subscription_duration | Integer | 총 회차 |
| service_start_at | String | 서비스 시작일 |

## 구독 상태 코드 (`status`)

| 키 | 값 | 설명 |
|----|----|------|
| `contract_requested_completed` | `0` | 구독 신청 완료, 승인 대기 |
| `subscribing` | `1` | 구독 중 |
| `auto_terminated` | `15` | 자동 해지 |
| `manual_terminated` | `20` | 직접 해지 |
| `mid_term_transfer_approved` | `25` | 중도 인수 승인 |
| `mid_term_transfer_requested` | `26` | 중도 인수 요청 |
| `free_trial` | `-1` | 무료 체험 |
| `temporarily_paused` | `-2` | 일시정지 |
| `paused_due_to_issue` | `-3` | 이슈로 인한 일시정지 |
| `first_payment_error` | `-10` | 첫 결제 오류 |
| `admin_terminated` | `-11` | 관리자 해지 |
| `rejected` | `-12` | 구독 거절 |

## 에러 코드

::: info 공통 에러
인증·권한 관련 에러는 [에러 코드표](https://commerce.bootpay.ai/api/reference/codes#커머스-api-인증-에러)를 참고합니다.
:::

::: error-codes

| 코드 | 메시지 | 대처 방법 |
|------|--------|-----------|
| `ORDER_SUBSCRIPTION_NOT_FOUND` | 구독결제 건을 찾을 수 없습니다. | `order_subscription_id`를 확인합니다 |

:::

## 함께 보기

- [계약 목록](https://commerce.bootpay.ai/api/subscription-contract/list) — 목록에서 계약 ID를 얻습니다
- [회차 조회](https://commerce.bootpay.ai/api/subscription-ops/bill/cycle) — 계약에 딸린 회차(빌)를 봅니다
- [계약 변경](https://commerce.bootpay.ai/api/subscription-ops/adjust/plan) — 수량·총회차를 바꿉니다
