상품을 등록합니다.
v1 API 상세: 상품
API 엔드포인트
필요 권한: user:product_create
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
name |
String | 필수 | 상품명 (서버가 빈 값을 검사하지 않으므로 반드시 보냅니다) |
desc |
String | 선택 | 상품 요약 설명 |
content |
String | 선택 | 상품 상세 설명 (HTML 지원) |
images |
File[] | 선택 | 대표 이미지 파일. 파일을 올릴 때는 multipart/form-data 를 사용합니다 |
category_id |
String | 선택 | 카테고리 ID |
display_price |
Integer | 필수 | 판매가 (표시가). 0보다 커야 합니다. 0원은 사용량 기반·수시결제 구독 상품만 허용됩니다 |
tax_free_price |
Integer | 선택 | 비과세 가격 |
use_stock |
Boolean | 선택 | 재고 관리 사용 여부 |
stock |
Integer | 선택 | 재고 수량 |
use_subscription |
Boolean | 선택 | 구독 상품 여부 |
subscription_setting_id |
String | 선택 | 구독 설정 템플릿 ID |
usage_api_url |
String | 선택 | 사용량 조회 URL. 종량제(사용량 기반) 구독 상품이면 필수이고, 비어 있으면 SUBSCRIPTION_SETTIGN_NEED_USAGE_API_URL 로 거절됩니다. 구독 설정이 아니라 상품에 저장됩니다 (종량제 구독) |
use_discount |
Boolean | 선택 | 할인 사용 여부 |
discount_price |
Integer | 선택 | 할인 금액 또는 할인율. 판매가에서 이 값만큼 뺍니다 (discount_price_type 참고) |
discount_price_type |
Integer | 선택 | 할인 단위 — 1 퍼센트 / 2 정액. 생략하면 정액으로 계산합니다 |
status_display |
Boolean | 선택 | 쇼핑몰 노출 여부 |
status_sale |
Boolean | 선택 | 판매 상태 |
ex_uid |
String | 선택 | 외부 시스템 고유 ID (external_uid 로도 받습니다) |
save_by |
Integer | 선택 | 저장 방식 (1 시스템 임시저장 / 2 사용자 임시저장 / 3 발행). 구독·배송 설정 검증은 3 을 명시해야 동작합니다. 생략하면 발행 상태로 저장되지만 이 검증을 건너뜁니다. 1·2 로 저장한 상품은 목록·상세·주문에 나오지 않습니다 |
use_subscription: true 로 구독 상품을 만들 때는 save_by: 3 을 함께 보내야 구독 설정·가격 검증이 실행됩니다. 생략하면 발행 상태로 저장되지만 검증을 건너뛰므로 구독 상품 등록에 사용하지 않습니다.
이 API 는 구독 기간별 가격(subscription_periods)을 받지 않습니다. 옵션 없는 구독 상품을 save_by: 3 으로 발행하면 기간별 가격이 없어 PRODUCT_PRICE_INVALID(HTTP 409)로 거절됩니다.
구독 상품은 관리자 > 상품 관리에서 만들고, 받은 product_id 를 체크아웃·구독에 사용합니다.
코드 예제
const { BootpayCommerce } = require('@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.create({
name: '드립백 커피 10개입',
desc: '매일 아침 한 잔',
display_price: 29900,
save_by: 3,
tax_type: 1,
ex_uid: 'shop-coffee-10',
status_visible: true,
status_display: true,
status_sale: true
})
console.log('product_id:', response.product_id)javascriptfrom bootpay_backend import BootpayCommerce
commerce = BootpayCommerce(
client_key='your-commerce-client-key',
secret_key='your-commerce-secret-key',
mode='production'
)
response = commerce.product.create(
name='드립백 커피 10개입',
desc='매일 아침 한 잔',
display_price=29900,
save_by=3,
tax_type=1,
ex_uid='shop-coffee-10',
status_visible=True,
status_display=True,
status_sale=True
)
print('product_id:', response['product_id'])pythonuse Bootpay\ServerPhp\BootpayCommerceApi;
$commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
$response = $commerce->productCreate([
'name' => '드립백 커피 10개입',
'desc' => '매일 아침 한 잔',
'display_price' => 29900,
'save_by' => 3,
'tax_type' => 1,
'ex_uid' => 'shop-coffee-10',
'status_visible' => true,
'status_display' => true,
'status_sale' => true
]);
print_r($response);phpimport 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.name = "드립백 커피 10개입";
// ⚠️ 상품 설명은 Java SDK 로 보낼 수 없습니다. SProduct.description 은 description 키로 전송되지만
// 커머스 API 는 desc 를 읽으므로 값이 버려집니다. 설명은 관리자 화면이나 REST 직접 호출로 입력합니다.
product.displayPrice = 29900.0;
product.statusDisplay = true;
product.statusSale = true;
BootpayStoreResponse response = commerce.product.create(product);
System.out.println(response);javarequire 'bootpay'
commerce = BootpayStore::RestClient.new(client_key: 'your-commerce-client-key', secret_key: 'your-commerce-secret-key')
response = commerce.product_create(
name: '드립백 커피 10개입',
desc: '매일 아침 한 잔',
display_price: 29900,
save_by: 3,
tax_type: 1,
ex_uid: 'shop-coffee-10',
status_visible: true,
status_display: true,
status_sale: true
)
puts responserubycommerce := bootpay.NewCommerceApi("your-commerce-client-key", "your-commerce-secret-key")
response, err := commerce.ProductCreate(map[string]interface{}{
"name": "드립백 커피 10개입",
"desc": "매일 아침 한 잔",
"display_price": 29900,
"save_by": 3,
"tax_type": 1,
"ex_uid": "shop-coffee-10",
"status_visible": true,
"status_display": true,
"status_sale": true,
})
fmt.Println(response)gousing Bootpay.Commerce;
var commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
var response = await commerce.ProductCreate(new {
name = "드립백 커피 10개입",
desc = "매일 아침 한 잔",
display_price = 29900,
save_by = 3,
tax_type = 1,
ex_uid = "shop-coffee-10",
status_visible = true,
status_display = true,
status_sale = true
});
Console.WriteLine(response);csharp응답
성공 응답
{
"product_id": "67c95e64d01640bb9859c629",
"save_by": 3
}json현재 상품이 저장된 뒤에 SERVER_ERROR(HTTP 500)가 반환됩니다. 같은 요청을 다시 보내면 상품이 중복 생성될 수 있습니다.
등록할 때 ex_uid 를 함께 보내고, 500 을 받으면 재시도하기 전에 상품 목록에서 ex_uid 로 저장 여부와 product_id 를 확인합니다. ex_uid 가 중복 생성을 막아 주지는 않습니다.
에러 응답
HTTP/1.1 409 Conflict
Content-Type: application/json{
"error_code": "PRODUCT_PRICE_INVALID",
"message": "상품가격은 0원 이상이여야 합니다."
}json에러 코드
인증·권한 에러는 에러 코드표를 참고합니다.
| 코드 | 메시지 | 대처 방법 |
|---|---|---|
PRODUCT_ |
상품가격은 0원 이상이어야 합니다. (HTTP 409) | display_price 를 0보다 큰 값으로 보냅니다. 0원은 사용량 기반·수시결제 구독 상품만 허용됩니다 |
현재 일반 상품의 display_price 가 0 이거나 없으면 PRODUCT_PRICE_INVALID 대신 SERVER_ERROR(HTTP 500)가 반환됩니다. display_price 는 항상 0보다 큰 값으로 보냅니다.
product_id 는 주문서 요청의 products[].product_id 에 사용합니다.



