상품 수정
v1 API 상세: 상품
등록된 상품 정보를 수정합니다.
API 엔드포인트
요청 파라미터
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| product_id | String | Y | 상품 ID (URL 경로) |
| name | String | N | 상품명 |
| desc | String | N | 상품 요약 설명 |
| content | String | N | 상품 상세 설명 (HTML 지원) |
| category_id | String | N | 카테고리 ID (키를 보내고 값을 비우면 해제) |
| display_price | Integer | N | 판매가 |
| tax_free_price | Integer | N | 비과세 가격 |
| use_stock | Boolean | N | 재고 관리 사용 여부 |
| stock | Integer | N | 재고 수량 |
| use_discount | Boolean | N | 할인 사용 여부 |
| discount_price | Integer | N | 할인 금액 또는 할인율. 판매가에서 이만큼 뺍니다 (discount_price_type 참고) |
| discount_price_type | Integer | N | 할인 단위 — 1 퍼센트 / 2 정액 |
| use_subscription | Boolean | N | 구독 상품 여부 |
| subscription_setting_id | String | N | 구독 설정 템플릿 ID (save_by: 3 필요) |
| status_display | Boolean | N | 쇼핑몰 노출 여부 |
| status_sale | Boolean | N | 판매 상태 |
| save_by | Integer | N | 저장 방식 (1 시스템 임시저장 / 2 사용자 임시저장 / 3 사용자 저장). 구독 설정 연결·검증은 3 일 때만 동작 |
코드 예제
curl -X PUT "https://api.bootapi.com/v1/products/67c95e64d01640bb9859c629" \
-H "Authorization: Basic {base64(client_key:secret_key)}" \
-H "Content-Type: application/json" \
-d '{
"name": "Enterprise 플랜",
"display_price": 59900,
"desc": "기업용 구독 서비스"
}'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.product.update({
product_id: '67c95e64d01640bb9859c629',
name: 'Enterprise 플랜',
display_price: 59900,
desc: '기업용 구독 서비스'
})
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.product.update({
'product_id': '67c95e64d01640bb9859c629',
'name': 'Enterprise 플랜',
'display_price': 59900,
'desc': '기업용 구독 서비스'
})
print(response)use Bootpay\ServerPhp\BootpayCommerceApi;
$commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
$response = $commerce->product->update([
'product_id' => '67c95e64d01640bb9859c629',
'name' => 'Enterprise 플랜',
'display_price' => 59900,
'desc' => '기업용 구독 서비스'
]);
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.pojo.SProduct;
TokenPayload tp = new TokenPayload(
"your-commerce-client-key",
"your-commerce-secret-key"
);
BootpayStore commerce = new BootpayStore(tp).withToken();
SProduct product = new SProduct();
product.productId = "67c95e64d01640bb9859c629";
product.name = "Enterprise 플랜";
product.displayPrice = 59900.0;
// ⚠️ SProduct 의 int · boolean 필드(statusDisplay · statusSale · useStock · stock · taxType 등)는
// 비워 둬도 false · 0 으로 함께 전송되고, 서버는 그 값을 그대로 저장합니다. 바꾸지 않을 필드도
// 지금 값으로 채워야 전시 · 판매가 꺼지거나 재고가 0 이 되지 않습니다 (상품 상세로 먼저 조회).
product.statusDisplay = true;
product.statusSale = true;
product.taxType = 1;
// ⚠️ 상품 설명은 Java SDK 로 보낼 수 없습니다 — SProduct.description 은 description 키로 나가는데
// 커머스 API 는 desc 를 읽으므로 값이 버려집니다. 설명은 관리자 화면이나 REST 직접 호출로 넣습니다.
BootpayStoreResponse response = commerce.product.update(product);
System.out.println(response);require 'bootpay'
commerce = BootpayStore::RestClient.new(
client_key: 'your-commerce-client-key',
secret_key: 'your-commerce-secret-key'
)
response = commerce.product_update(
product_id: '67c95e64d01640bb9859c629',
name: 'Enterprise 플랜',
display_price: 59900,
desc: '기업용 구독 서비스'
)
puts response.dataimport "github.com/bootpay/backend-go/v2"
commerce := bootpay.NewCommerceAPI("your-commerce-client-key", "your-commerce-secret-key", nil, "production")
// Go SDK 의 CommerceProduct 에는 desc 칸이 없어 범용 Put 으로 보냅니다
response, err := commerce.Put("products/67c95e64d01640bb9859c629", map[string]interface{}{
"name": "Enterprise 플랜",
"display_price": 59900,
"desc": "기업용 구독 서비스",
})
fmt.Println(response, err)using Bootpay.Commerce;
using System.Net.Http;
var commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
// .NET SDK 의 CommerceProduct 에는 desc 속성이 없어 SendAsync 로 보냅니다
var response = await commerce.SendAsync("products/67c95e64d01640bb9859c629", HttpMethod.Put, new {
name = "Enterprise 플랜",
display_price = 59900,
desc = "기업용 구독 서비스"
});
Console.WriteLine(await response.Content.ReadAsStringAsync());응답
성공 응답
JSON
{
"product_id": "67c95e64d01640bb9859c629",
"save_by": 3
}수정된 전체 값이 필요하면 상품 상세를 다시 불러옵니다.
에러 코드
오류 코드
| 코드 | 메시지 | 대처 방법 |
|---|---|---|
PRODUCT_NOT_FOUND | 존재하지 않는 상품입니다 | product_id를 확인합니다 |
PRODUCT_FROZEN | 판매금지된 상품은 편집/저장 안됩니다. 관리자에게 문의 바랍니다 | 관리자에게 문의합니다 |