# 회차 조회

원문: https://commerce.bootpay.ai/api/subscription-ops/bill/cycle

> 구독 계약에 따라 만들어진 회차 목록을 조회합니다. 회차마다 결제 상태 · 금액 · 결제 예정 시각이 오고, 계약 ID 를 빼면 프로젝트 전체 회차가 나옵니다.

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

구독 계약에 따라 생성된 회차(Bill) 목록을 조회합니다. 회차마다 결제 상태, 금액, 거래 정보가 함께 옵니다.

## API 엔드포인트

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

## 요청 파라미터

::: parameters

| 파라미터 | 타입 | 필수 | 설명 |
|---------|------|------|------|
| order_subscription_id | String | N | 구독 계약 고유 번호 (없으면 전체 조회) |
| status | String \| Integer \| Array | N | 회차 상태 필터 (숫자 또는 `bill_ready` 같은 키). 여러 값은 `status[]=bill_ready&status[]=bill_failed` 또는 `status=2,-1`로 보냅니다 |
| page | Number | N | 페이지 번호 |
| limit | Number | N | 페이지당 데이터 수 (기본 20, 100 을 넘기면 20 으로 돌아갑니다) |

:::

::: warning 구독 ID를 먼저 확인합니다
`order_subscription_id`가 이 프로젝트에 없는 값이면 구독 조건이 빠지고 프로젝트 전체 회차가 조회됩니다. 특정 계약의 회차를 보여주려면 [계약 상세](https://commerce.bootpay.ai/api/subscription-contract/detail)로 ID를 확인합니다.
:::

## 코드 예제

::: code-group

```bash [cURL]
curl -X GET "https://api.bootapi.com/v1/order_subscription_bills?order_subscription_id={id}&page=1&limit=10" \
  -H "Authorization: Basic {base64(client_key:secret_key)}" \
  -H "Content-Type: application/json"
```

```javascript [Node.js]
import { BootpayCommerce } from '@bootpay/backend-js'

const commerce = new BootpayCommerce({
    client_key: '{client_key}',
    secret_key: '{secret_key}'
})

const response = await commerce.orderSubscriptionBill.list({
    order_subscription_id: '687a1b2c3d4e5f6789012345',
    page: 1,
    limit: 10
})
console.log(response)
```

```python [Python]
from bootpay_backend.commerce import BootpayCommerce

commerce = BootpayCommerce('{client_key}', '{secret_key}')
response = commerce.order_subscription_bill.list({
    'order_subscription_id': '687a1b2c3d4e5f6789012345',
    'page': 1,
    'limit': 10
})
print(response)
```

```php [PHP]
use Bootpay\ServerPhp\BootpayCommerceApi;

$commerce = new BootpayCommerceApi('{client_key}', '{secret_key}');
$response = $commerce->orderSubscriptionBill->getList([
    'order_subscription_id' => '687a1b2c3d4e5f6789012345',
    'page' => 1,
    'limit' => 10
]);
print_r($response);
```

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

TokenPayload tokenPayload = new TokenPayload("{client_key}", "{secret_key}");
BootpayStore commerce = new BootpayStore(tokenPayload).withToken();

OrderSubscriptionBillListParams params = new OrderSubscriptionBillListParams();
params.orderSubscriptionId = "687a1b2c3d4e5f6789012345";
params.page = 1;
params.limit = 10;

BootpayStoreResponse response = commerce.orderSubscriptionBill.list(params);
System.out.println(response);
```

```ruby [Ruby]
require 'bootpay'

commerce = BootpayStore::RestClient.new(client_key: '{client_key}', secret_key: '{secret_key}')
response = commerce.order_subscription_bill_list(
  order_subscription_id: '687a1b2c3d4e5f6789012345',
  page: 1,
  limit: 10
)
puts response.data
```

```go [Go]
commerce := bootpay.NewCommerceAPI("{client_key}", "{secret_key}", nil, "production")
response, err := commerce.OrderSubscriptionBill.List(&bootpay.OrderSubscriptionBillListParams{
    ListParams:          bootpay.ListParams{Page: 1, Limit: 10},
    OrderSubscriptionId: "687a1b2c3d4e5f6789012345",
})
fmt.Println(response, err)
```

```csharp [.NET]
var commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
var response = await commerce.OrderSubscriptionBillList(new OrderSubscriptionBillListParams {
    OrderSubscriptionId = "687a1b2c3d4e5f6789012345",
    Page = 1,
    Limit = 10
});
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

:::

## 응답

```json
{
  "list": [
    {
      "order_subscription_bill_id": "6965f45c4cb8149d0771250d",
      "duration": 1,
      "price": 1000,
      "tax_free_price": 0,
      "status": "bill_completed",
      "reserve_payment_at": "2026-01-12T15:00:00Z",
      "purchased_at": "2026-01-13T07:29:33Z",
      "order_subscription_transaction": {
        "order_subscription_transaction_id": "6965f45c4cb8149d0771250e",
        "purchase_price": 1000,
        "purchase_tax_free_price": 0,
        "status": "bill_completed"
      }
    }
  ],
  "count": 24
}
```

## 응답 파라미터

| 파라미터 | 타입 | 설명 |
|---------|------|------|
| count | Number | 전체 회차 수 |
| list | Array | 회차 목록 |
| &nbsp;&nbsp;└─ order_subscription_bill_id | String | 회차 고유 ID |
| &nbsp;&nbsp;└─ duration | Integer | 회차 번호 |
| &nbsp;&nbsp;└─ price | Number | 회차 금액 |
| &nbsp;&nbsp;└─ tax_free_price | Number | 면세 금액 |
| &nbsp;&nbsp;└─ status | String | 회차 상태 |
| &nbsp;&nbsp;└─ reserve_payment_at | String | 결제 예정 시각 |
| &nbsp;&nbsp;└─ purchased_at | String | 실제 결제 시각 |
| &nbsp;&nbsp;└─ order_subscription_transaction | Object | 연결된 거래 정보 |

## 회차 상태 코드 (`list[].status`)

| 값 | 키 | 설명 |
|----|-----|------|
| `2` | `bill_ready` | 결제 대기중 |
| `1` | `bill_completed` | 결제 완료 |
| `5` | `bill_pending` | 결제 지연 |
| `6` | `bill_failure_delayed` | 결제 실패 후 재시도 대기 |
| `10` | `bill_cancelled` | 관리자 취소 |
| `11` | `bill_paused` | 청구 일시정지 |
| `20` | `bill_terminated` | 해지로 인한 취소 |
| `-1` | `bill_failed` | 결제 실패 |
| `-2` | `bill_recreate_cancelled` | 회차 재생성으로 취소됨 |
| `-11` | `bill_schedule_cancelled_by_payment_failure` | 결제 실패로 스케줄 취소 |
| `-100` | `bill_error` | 청구 오류 |

:::canvas-flow
{
  "nodes": [
    { "id": "waiting", "label": "결제 대기\nbill_ready", "col": 1, "row": 1, "type": "process" },
    { "id": "completed", "label": "결제 완료\nbill_completed", "col": 1, "row": 0, "type": "success" },
    { "id": "failed", "label": "결제 실패\nbill_failed", "col": 1, "row": 2, "type": "warning" },
    { "id": "delayed", "label": "결제 지연\nbill_pending", "col": 0, "row": 1, "type": "process" },
    { "id": "retry", "label": "재시도 대기\nbill_failure_delayed · 결제 대기로 돌아감", "col": 2, "row": 2, "type": "process" },
    { "id": "cancel", "label": "취소\n(-2, 10, 20)", "col": 2, "row": 1, "type": "warning" }
  ],
  "edges": [
    { "from": "waiting", "to": "completed", "label": "성공" },
    { "from": "waiting", "to": "failed", "label": "실패" },
    { "from": "waiting", "to": "delayed", "label": "지연" },
    { "from": "waiting", "to": "cancel", "label": "취소" },
    { "from": "failed", "to": "retry", "label": "재시도 예약" },
    { "from": "retry", "to": "waiting" }
  ],
  "direction": "TB",
  "cols": 3,
  "rows": 3
}
:::
