구독 계약의 회차 금액 조정 항목을 한번에 변경하는 API예요. 요청한 항목으로 기존 내용을 모두 대체해요.
API 엔드포인트
PUT
https://api.bootapi.com/v1/order_subscriptions/:id/adjustmentsBearer Token (supervisor)관리자 권한 필요
이 API는 supervisor 권한이 필요해요. 관리자 토큰으로 요청해요.
전체 대체 방식
기존 조정 항목이 모두 삭제되고 요청한 항목으로 대체돼요. 수정이 아닌 전체 교체예요. 특정 항목만 삭제하려면 조정 항목 삭제를 사용해요.
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
order_subscription_id |
String | 필수 | 구독 계약 고유 번호 (URL 파라미터) |
adjustments |
Array | 필수 | 대체할 조정 항목 배열 |
adjustments[].name |
String | 필수 | 조정 항목명 |
adjustments[].price |
Integer | 필수 | 조정 금액 |
adjustments[].tax_free_price |
Integer | 선택 | 면세 금액 |
adjustments[].type |
Integer | 필수 | 조정 타입 |
adjustments[].duration |
Integer | 선택 | 적용 회차 |
코드 예제
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 '{
"adjustments": [
{
"name": "설치비",
"price": 50000,
"type": 2
},
{
"name": "프로모션 할인",
"price": -10000,
"type": 0,
"duration": 1
}
]
}'bashconst { BootpayCommerce } = require('@bootpay/backend-js');
const commerce = new BootpayCommerce({
client_key: '{client_key}',
secret_key: '{secret_key}'
});
const response = await commerce.orderSubscriptionBill.adjustment.update('687a1b2c3d4e5f6789012345', {
adjustments: [
{ name: '설치비', price: 50000, type: 2 },
{ name: '프로모션 할인', price: -10000, type: 0, duration: 1 }
]
});
console.log(response);javascriptfrom bootpay_backend.commerce import BootpayCommerce
commerce = BootpayCommerce('{client_key}', '{secret_key}')
response = commerce.order_subscription_adjustment_update('687a1b2c3d4e5f6789012345', {
'adjustments': [
{'name': '설치비', 'price': 50000, 'type': 2},
{'name': '프로모션 할인', 'price': -10000, 'type': 0, 'duration': 1}
]
})
print(response)pythonuse Bootpay\ServerPhp\BootpayCommerceApi;
$commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
$response = $commerce->orderSubscriptionAdjustmentUpdate('687a1b2c3d4e5f6789012345', [
'adjustments' => [
['name' => '설치비', 'price' => 50000, 'type' => 2],
['name' => '프로모션 할인', 'price' => -10000, 'type' => 0, 'duration' => 1]
]
]);
print_r($response);phpBootpayCommerceApi commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
List<Map<String, Object>> adjustments = new ArrayList<>();
Map<String, Object> adj1 = new HashMap<>();
adj1.put("name", "설치비");
adj1.put("price", 50000);
adj1.put("type", 2);
adjustments.add(adj1);
Map<String, Object> adj2 = new HashMap<>();
adj2.put("name", "프로모션 할인");
adj2.put("price", -10000);
adj2.put("type", 0);
adj2.put("duration", 1);
adjustments.add(adj2);
HashMap<String, Object> params = new HashMap<>();
params.put("adjustments", adjustments);
HashMap<String, Object> response = commerce.orderSubscriptionAdjustmentUpdate("687a1b2c3d4e5f6789012345", params);
System.out.println(response);javacommerce = BootpayStore::Api.new('{client_key}', '{secret_key}')
response = commerce.order_subscription_adjustment_update('687a1b2c3d4e5f6789012345', {
adjustments: [
{ name: '설치비', price: 50000, type: 2 },
{ name: '프로모션 할인', price: -10000, type: 0, duration: 1 }
]
})
puts responserubycommerce := bootpay.NewCommerceApi("{client_key}", "{secret_key}")
response, err := commerce.OrderSubscriptionAdjustmentUpdate("687a1b2c3d4e5f6789012345", map[string]interface{}{
"adjustments": []map[string]interface{}{
{"name": "설치비", "price": 50000, "type": 2},
{"name": "프로모션 할인", "price": -10000, "type": 0, "duration": 1},
},
})
fmt.Println(response)govar commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
var response = await commerce.OrderSubscriptionAdjustmentUpdate("687a1b2c3d4e5f6789012345", new {
adjustments = new[] {
new { name = "설치비", price = 50000, type = 2 },
new { name = "프로모션 할인", price = -10000, type = 0, duration = 1 }
}
});
Console.WriteLine(response);csharp응답
성공 응답
{
"order_subscription_id": "687a1b2c3d4e5f6789012345",
"order_subscription_adjustments": [
{
"id": "adj_001",
"name": "설치비",
"price": 50000,
"type": 2
},
{
"id": "adj_002",
"name": "프로모션 할인",
"price": -10000,
"type": 0,
"duration": 1
}
]
}json응답 파라미터
| 파라미터 | 타입 | 설명 |
|---|---|---|
| order_subscription_id | String | 구독 계약 ID |
| order_subscription_adjustments | Array | 변경된 전체 조정 항목 목록 |
에러 코드
공통 에러
인증·권한 관련 에러는 에러 코드표를 참고해요.
| 코드 | 메시지 | 대처 방법 |
|---|---|---|
SUBSCRIPTION_ADJUSTMENT_NOT_FOUND |
구독결제 조정 정보를 찾을 수 없어요. | adjustment_id를 확인해요 |
SUBSCRIPTION_ADJUSTMENT_PAYMENT_COMPLETED |
이미 결제가 완료된 회차예요. 가격조정을 할 수 없어요. | 미결제 회차에 대해서만 조정해요 |
SUBSCRIPTION_ADJUSTMENT_DURATION_INVALID |
회차가 지정되지 않았어요. 조정할 회차를 지정해요. | cycle 파라미터를 입력해요 |
