# 재개

원문: https://commerce.bootpay.ai/api/subscription-ops/manage/resume

> 일시정지된 구독을 다시 시작합니다. 고객이 요청한 재개는 관리자 승인 없이 바로 처리되고, 다음 결제 주기부터 자동 결제가 이어집니다.

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

일시정지된 구독을 재개합니다. 재개 후 다음 결제 주기부터 자동 결제가 다시 시작됩니다.

## API 엔드포인트

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

## 요청 파라미터

::: parameters

| 파라미터 | 타입 | 필수 | 설명 |
|---------|------|------|------|
| order_subscription_id | String | Y | 구독 계약 고유 번호 |
| user_id | String | N | 로그인한 회원 ID 또는 이 몰의 외부 회원 ID. 보내면 구독 소유자와 대조합니다. `Bootpay-User-JWT` 헤더로 보내도 됩니다 |
| reason | String | N | 재개 요청 사유 |

:::

## 코드 예제

::: code-group

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

const commerce = new BootpayCommerce({
    client_key: 'your-commerce-client-key',
    secret_key: 'your-commerce-secret-key',
    mode: 'production'
})

const response = await commerce.orderSubscription.requestIng.resume({
    order_subscription_id: '687a1b2c3d4e5f6789012345',
    reason: '일시정지 사유 해소로 재개 요청'
})
console.log(response)
```

```python [Python]
from bootpay_backend import BootpayCommerce

commerce = BootpayCommerce(
    client_key='your-commerce-client-key',
    secret_key='your-commerce-secret-key',
    mode='production'
)

response = commerce.order_subscription.request_ing.resume({
    'order_subscription_id': '687a1b2c3d4e5f6789012345',
    'reason': '일시정지 사유 해소로 재개 요청'
})
print(response)
```

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

$commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
$response = $commerce->orderSubscription->requestIng->resume([
    'order_subscription_id' => '687a1b2c3d4e5f6789012345',
    'reason' => '일시정지 사유 해소로 재개 요청'
]);
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.orderSubscription.request.ing.OrderSubscriptionResumeParams;

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

OrderSubscriptionResumeParams params = new OrderSubscriptionResumeParams();
params.orderSubscriptionId = "687a1b2c3d4e5f6789012345";
params.reason = "일시정지 사유 해소로 재개 요청";

BootpayStoreResponse response = commerce.orderSubscription.requestIng.resume(params);
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_requests_ing_resume(
  order_subscription_id: '687a1b2c3d4e5f6789012345',
  reason: '일시정지 사유 해소로 재개 요청'
)
puts response.data
```

```go [Go]
commerce := bootpay.NewCommerceAPI("your-commerce-client-key", "your-commerce-secret-key", nil, "production")
response, err := commerce.OrderSubscription.RequestIng.Resume(bootpay.OrderSubscriptionResumeParams{
    OrderSubscriptionId: "687a1b2c3d4e5f6789012345",
    Reason:              "일시정지 사유 해소로 재개 요청",
})
fmt.Println(response, err)
```

```csharp [.NET]
using Bootpay.Commerce;
using Bootpay.Commerce.Models;

var commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
var response = await commerce.OrderSubscriptionResume(new OrderSubscriptionResumeParams {
    OrderSubscriptionId = "687a1b2c3d4e5f6789012345"
});  // .NET SDK 의 재개 파라미터에는 reason 이 없습니다
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

:::

## 응답

#### 성공 응답

고객 재개는 관리자 승인 없이 즉시 처리되고, 재개가 반영된 구독 계약 상세 전체를 돌려줍니다. 아래는 일부만 정리한 예시입니다.

```json
{
  "order_subscription_id": "687a1b2c3d4e5f6789012345",
  "status": "subscribing",
  "pause_resumed_at": "2025-08-15T10:00:00+09:00",
  "request_histories": [
    { "request_type": "request_resume", "request_status": "request_approved_auto" }
  ]
}
```

## 응답 필드 설명

| 필드 | 타입 | 설명 |
|------|------|------|
| `order_subscription_id` | String | 구독 계약 고유 ID |
| `status` | String | 변경된 구독 상태 (`subscribing`: 구독 중) |
| `pause_resumed_at` | String | 재개 시각 |
| `request_histories` | Array | 이 구독의 요청 이력. 재개 요청은 `request_type` 이 `request_resume` (내부값 `12`). [요청 유형 전체](https://commerce.bootpay.ai/api/subscription-contract/requests#요청-유형-request_type) |

## 에러 코드

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

::: error-codes

| 코드 | 메시지 | 대처 방법 |
|------|--------|-----------|
| `ORDER_SUBSCRIPTION_NOT_FOUND` | 구독결제 건을 찾을 수 없습니다. | order_subscription_id를 확인합니다 |
| `ORDER_SUBSCRIPTION_RESUME_UNABLE` | 현재 일시정지 상태가 아니므로 재개할 수 없습니다 | 구독 상태를 확인합니다 |
| `ORDER_SUBSCRIPTION_RESUME_REQUEST_DUPLICATE` | 이미 대기 중인 재개 요청이 있습니다. | 기존 요청 처리를 기다립니다 |

:::

::: tip
재개는 구독 상태가 일시정지(`temporarily_paused`, -2)일 때만 요청할 수 있습니다.
:::

::: info 관리자가 직접 재개할 때
관리자는 `PUT /v1/order_subscriptions/:order_subscription_id/resume` (supervisor 권한, 본문 `reason` 선택)으로 바로 재개합니다. 이 API도 일시정지(`temporarily_paused`) 상태인 구독만 재개할 수 있습니다.
:::
