계약 내용 변경
활성 구독 계약의 내용을 변경합니다. 상품 구성, 수량, 회차 수, 결제 금액, 수령인 정보, 서비스 기간 등을 수정할 수 있습니다. 바뀐 값만 보내면 나머지는 그대로 유지됩니다.
API 엔드포인트
요청 파라미터
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| id | String | Y | 구독 계약 ID (URL 경로) |
| product_id | String | N | 변경할 상품 ID |
| product_option_id | String | N | 변경할 상품 옵션 ID |
| order_name | String | N | 주문명 |
| price | Integer | N | 회차별 결제 금액(기준금액). 0보다 커야 합니다. 결제예정 회차부터 반영됩니다 |
| quantity | Integer | N | 수량 |
| total_subscription_duration | Integer | N | 총 구독 회차 수 |
| address_id | String | N | 배송지 ID |
| username | String | N | 수령인 이름 |
| phone | String | N | 수령인 연락처 |
| String | N | 수령인 이메일 | |
| use_free_trial | Boolean | N | 무료 체험 사용 여부 |
| free_trial_day | Integer | N | 무료 체험 일수 |
| service_start_at | String | N | 서비스 시작일 |
| service_end_at | String | N | 서비스 종료일 |
| memo | String | N | 변경 이력에 남길 사유 |
코드 예제
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.update({
order_subscription_id: '687a1b2c3d4e5f6789012345',
quantity: 2,
total_subscription_duration: 12,
price: 45000
})
console.log(response)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.update({
'order_subscription_id': '687a1b2c3d4e5f6789012345',
'quantity': 2,
'total_subscription_duration': 12,
'price': 45000
})
print(response)use Bootpay\ServerPhp\BootpayCommerceApi;
$commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
$response = $commerce->orderSubscription->update([
'order_subscription_id' => '687a1b2c3d4e5f6789012345',
'quantity' => 2,
'total_subscription_duration' => 12,
'price' => 45000
]);
print_r($response);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.OrderSubscriptionUpdateParams;
TokenPayload tp = new TokenPayload("your-commerce-client-key", "your-commerce-secret-key");
BootpayStore commerce = new BootpayStore(tp).withToken();
OrderSubscriptionUpdateParams params = new OrderSubscriptionUpdateParams();
params.orderSubscriptionId = "687a1b2c3d4e5f6789012345";
params.quantity = 2.0;
params.totalSubscriptionDuration = 12.0;
params.price = 45000.0;
BootpayStoreResponse response = commerce.orderSubscription.update(params);
System.out.println(response);require 'bootpay'
commerce = BootpayStore::RestClient.new(client_key: 'your-commerce-client-key', secret_key: 'your-commerce-secret-key')
response = commerce.order_subscription_update(
order_subscription_id: '687a1b2c3d4e5f6789012345',
quantity: 2,
total_subscription_duration: 12,
price: 45000
)
puts response.datacommerce := bootpay.NewCommerceAPI("your-commerce-client-key", "your-commerce-secret-key", nil, "production")
response, err := commerce.OrderSubscription.Update(bootpay.OrderSubscriptionUpdateParams{
OrderSubscriptionId: "687a1b2c3d4e5f6789012345",
Quantity: 2,
TotalSubscriptionDuration: 12,
Price: 45000,
})
fmt.Println(response, err)using Bootpay.Commerce;
using Bootpay.Commerce.Models;
var commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
var response = await commerce.OrderSubscriptionUpdate(new OrderSubscriptionUpdateParams {
OrderSubscriptionId = "687a1b2c3d4e5f6789012345",
Quantity = 2,
TotalSubscriptionDuration = 12,
Price = 45000
});
Console.WriteLine(await response.Content.ReadAsStringAsync());응답
성공 응답
변경이 반영된 구독 계약 상세 전체를 돌려줍니다. 아래는 일부만 정리한 예시입니다.
JSON
{
"order_subscription_id": "687a1b2c3d4e5f6789012345",
"status": "subscribing",
"price": 45000,
"quantity": 2,
"total_subscription_duration": 12
}구독 상태 (status)
내용 변경은 상태를 바꾸지 않습니다. 구독 중이면 응답도 subscribing 그대로입니다.
전체 값은 구독 상태에 있습니다.
| 키 | 값 | 설명 |
|---|---|---|
subscribing | 1 | 구독 중 (정상 결제 진행) |
에러 코드
오류 코드
| 코드 | 메시지 | 대처 방법 |
|---|---|---|
ORDER_SUBSCRIPTION_INVALID | 구독결제 정보가 올바르지 않습니다. | 구독 계약 ID와 프로젝트를 확인합니다 |
PRODUCT_QTY_INVALID | 상품 수량 개수가 잘못되었습니다. | quantity 를 1 이상으로 보냅니다 |
ORDER_SUBSCRIPTION_SERVICE_DATE_INVALID | 구독 서비스 기간이 유효하지 않습니다. | service_start_at·service_end_at 을 확인합니다 |
ORDER_SUBSCRIPTION_SERVICE_DATE_WRONG | 잘못된 계약기간입니다. | 시작일이 종료일보다 앞서게 보냅니다 |
ORDER_SUBSCRIPTION_PRICE_INVALID | 유효하지 않은 가격입니다. | price를 0보다 큰 값으로 보냅니다 |
SUBSCRIPTION_ADJUSTMENT_NEGATIVE_PRICE | 기본 결제 금액이 음수가 됩니다. | 회차 조정 금액을 함께 확인합니다 |