조정 항목 전체 변경
구독 계약의 회차 금액 조정 항목을 한번에 변경합니다. 지정한 회차(duration)의 조정 항목을 요청한 항목으로 모두 대체합니다.
API 엔드포인트
PUT
/v1/order_subscriptions/:id/adjustmentsBase URLhttps://api.bootapi.com
요청 파라미터
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| order_subscription_id | String | Y | 구독 계약 고유 번호 (URL 경로) |
| duration | Integer | N | 대체 대상 회차. 요청 최상위 파라미터입니다 (기본 1) |
| adjustments | Array | Y | 해당 회차를 대체할 조정 항목 배열 |
| └─ name | String | Y | 조정 항목명 |
| └─ price | Integer | Y | 조정 금액 |
| └─ tax_free_price | Integer | N | 면세 금액 |
| └─ type | Integer | Y | 조정 타입 숫자(아래 표의 값). 항목 안에 duration 을 넣어도 무시됩니다 |
코드 예제
curl -X PUT "https://api.bootapi.com/v1/order_subscriptions/{order_subscription_id}/adjustments" \
-H "Authorization: Basic {base64(client_key:secret_key)}" \
-H "Content-Type: application/json" \
-d '{
"duration": 1,
"adjustments": [
{
"name": "설치비",
"price": 50000,
"type": 2
},
{
"name": "프로모션 할인",
"price": -10000,
"type": 1
}
]
}'import { BootpayCommerce } from '@bootpay/backend-js';
const commerce = new BootpayCommerce({
client_key: '{client_key}',
secret_key: '{secret_key}'
});
const response = await commerce.orderSubscriptionAdjustment.update({
order_subscription_id: '687a1b2c3d4e5f6789012345',
duration: 1,
adjustments: [
{ name: '설치비', price: 50000, type: 2 },
{ name: '프로모션 할인', price: -10000, type: 1 }
]
});
console.log(response);from bootpay_backend.commerce import BootpayCommerce
commerce = BootpayCommerce('{client_key}', '{secret_key}')
response = commerce.order_subscription_adjustment.update({
'order_subscription_id': '687a1b2c3d4e5f6789012345',
'duration': 1,
'adjustments': [
{'name': '설치비', 'price': 50000, 'type': 2},
{'name': '프로모션 할인', 'price': -10000, 'type': 1}
]
})
print(response)use Bootpay\ServerPhp\BootpayCommerceApi;
$commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
$response = $commerce->orderSubscriptionAdjustment->update([
'order_subscription_id' => '687a1b2c3d4e5f6789012345',
'duration' => 1,
'adjustments' => [
['name' => '설치비', 'price' => 50000, 'type' => 2],
['name' => '프로모션 할인', 'price' => -10000, 'type' => 1]
]
]);
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.orderSubscriptionAdjustment.OrderSubscriptionAdjustmentUpdateParams;
import kr.co.bootpay.store.model.pojo.SOrderSubscriptionAdjustment;
import java.util.Arrays;
TokenPayload tokenPayload = new TokenPayload("{client_key}", "{secret_key}");
BootpayStore commerce = new BootpayStore(tokenPayload).withToken();
SOrderSubscriptionAdjustment adj1 = new SOrderSubscriptionAdjustment();
adj1.name = "설치비";
adj1.price = 50000.0;
adj1.type = 2;
SOrderSubscriptionAdjustment adj2 = new SOrderSubscriptionAdjustment();
adj2.name = "프로모션 할인";
adj2.price = -10000.0;
adj2.type = 1;
OrderSubscriptionAdjustmentUpdateParams params = new OrderSubscriptionAdjustmentUpdateParams();
params.orderSubscriptionId = "687a1b2c3d4e5f6789012345";
params.duration = 1;
params.adjustments = Arrays.asList(adj1, adj2);
BootpayStoreResponse response = commerce.orderSubscriptionAdjustment.update(params);
System.out.println(response);require 'bootpay'
commerce = BootpayStore::RestClient.new(client_key: '{client_key}', secret_key: '{secret_key}')
response = commerce.order_subscription_adjustment_update(
order_subscription_id: '687a1b2c3d4e5f6789012345',
duration: 1,
adjustments: [
{ name: '설치비', price: 50000, type: 2 },
{ name: '프로모션 할인', price: -10000, type: 1 }
]
)
puts response.datacommerce := bootpay.NewCommerceAPI("{client_key}", "{secret_key}", nil, "production")
response, err := commerce.OrderSubscriptionAdjustment.Update(bootpay.OrderSubscriptionAdjustmentUpdateParams{
OrderSubscriptionId: "687a1b2c3d4e5f6789012345",
Duration: 1,
Adjustments: []bootpay.CommerceOrderSubscriptionAdjustment{
{Name: "설치비", Price: 50000, Type: 2},
{Name: "프로모션 할인", Price: -10000, Type: 1},
},
})
fmt.Println(response, err)var commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
var response = await commerce.OrderSubscriptionAdjustmentUpdate(new OrderSubscriptionAdjustmentUpdateParams {
OrderSubscriptionId = "687a1b2c3d4e5f6789012345",
Duration = 1,
Adjustments = new List<CommerceOrderSubscriptionAdjustment> {
new CommerceOrderSubscriptionAdjustment { Name = "설치비", Price = 50000, Type = 2 },
new CommerceOrderSubscriptionAdjustment { Name = "프로모션 할인", Price = -10000, Type = 1 }
}
});
Console.WriteLine(await response.Content.ReadAsStringAsync());응답
성공 응답
변경이 반영된 구독 계약 상세 전체를 돌려줍니다. 아래는 조정 항목 부분만 정리한 예시입니다.
JSON
{
"order_subscription_id": "687a1b2c3d4e5f6789012345",
"order_subscription_adjustments": [
{
"order_subscription_adjustment_id": "6965fc104cb8149d07712533",
"name": "설치비",
"price": 50000,
"tax_free_price": 0,
"type": "setup_price",
"duration": 1,
"is_unlimited": false
},
{
"order_subscription_adjustment_id": "6965fc104cb8149d07712534",
"name": "프로모션 할인",
"price": -10000,
"tax_free_price": 0,
"type": "discount",
"duration": 1,
"is_unlimited": false
}
]
}응답 파라미터
| 파라미터 | 타입 | 설명 |
|---|---|---|
| order_subscription_id | String | 구독 계약 ID |
| order_subscription_adjustments | Array | 계약에 걸린 전체 조정 항목 목록 (다른 회차·무제한 조정 포함) |
조정 타입 (type)
| 값 | 키 | 설명 |
|---|---|---|
1 | discount | 회차별 할인 적용 |
2 | setup_price | 추가금액 (설치비 등) |
3 | cycle_discount | 주기 할인 적용 |
4 | cycle_additional_fee | 추가 비용 적용 |
5 | recurring_fee | 매회차 추가비용 (모든 할인 적용 후) |
10 | coupon | 구독 상품 금액 쿠폰 |
11 | shipping_coupon | 배송비 쿠폰 |
에러 코드
오류 코드
| 코드 | 메시지 | 대처 방법 |
|---|---|---|
ORDER_SUBSCRIPTION_INVALID | 구독결제 정보가 올바르지 않습니다. | 구독 계약 ID를 확인합니다 |
SUBSCRIPTION_ADJUSTMENT_PAYMENT_COMPLETED | 이미 결제가 완료된 회차입니다. 가격조정을 할 수 없습니다. | 미결제 회차에 대해서만 조정합니다 |
SUBSCRIPTION_ADJUSTMENT_NEGATIVE_PRICE | 회차 가격 조정으로 인해 최종 결제 금액이 음수가 될 수 없습니다. | 조정 금액을 다시 확인합니다 |