상품 등록
상품을 등록합니다.
v1 API 상세: 상품
API 엔드포인트
요청 파라미터
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| name | String | Y | 상품명 (서버가 빈 값을 검사하지 않으므로 반드시 보냅니다) |
| desc | String | N | 상품 요약 설명 |
| content | String | N | 상품 상세 설명 (HTML 지원) |
| images | File[] | N | 대표 이미지 파일. 파일을 올릴 때는 multipart/form-data 를 사용합니다 |
| category_id | String | N | 카테고리 ID |
| display_price | Integer | Y | 판매가 (표시가). 0보다 커야 합니다. 0원은 사용량 기반·수시결제 구독 상품만 허용됩니다 |
| tax_free_price | Integer | N | 비과세 가격 |
| use_stock | Boolean | N | 재고 관리 사용 여부 |
| stock | Integer | N | 재고 수량 |
| use_subscription | Boolean | N | 구독 상품 여부 |
| subscription_setting_id | String | N | 구독 설정 템플릿 ID |
| usage_api_url | String | N | 사용량 조회 URL. 종량제(사용량 기반) 구독 상품이면 필수이고, 비어 있으면 SUBSCRIPTION_SETTIGN_NEED_USAGE_API_URL 로 거절됩니다. 구독 설정이 아니라 상품에 저장됩니다 (사용량 API) |
| use_discount | Boolean | N | 할인 사용 여부 |
| discount_price | Integer | N | 할인 금액 또는 할인율. 판매가에서 이 값만큼 뺍니다 (discount_price_type 참고) |
| discount_price_type | Integer | N | 할인 단위 — 1 퍼센트 / 2 정액. 생략하면 정액으로 계산합니다 |
| status_display | Boolean | N | 쇼핑몰 노출 여부 |
| status_sale | Boolean | N | 판매 상태 |
| ex_uid | String | N | 외부 시스템 고유 ID (external_uid 로도 받습니다) |
| save_by | Integer | N | 저장 방식 (1 시스템 임시저장 / 2 사용자 임시저장 / 3 발행). 구독·배송 설정 검증은 3 을 명시해야 동작합니다. 생략하면 발행 상태로 저장되지만 이 검증을 건너뜁니다. 1·2 로 저장한 상품은 목록·상세·주문에 나오지 않습니다 |
코드 예제
curl -X POST "https://api.bootapi.com/v1/products" \
-H "Authorization: Basic {base64(client_key:secret_key)}" \
-H "Content-Type: application/json" \
-d '{
"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
}'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.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)from 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'])use Bootpay\ServerPhp\BootpayCommerceApi;
$commerce = new BootpayCommerceApi("your-commerce-client-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
]);
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.name = "드립백 커피 10개입";
// ⚠️ 상품 설명은 Java SDK 로 보낼 수 없습니다. SProduct.description 은 description 키로 전송되지만
// 커머스 API 는 desc 를 읽으므로 값이 버려집니다. 설명은 관리자 화면이나 REST 직접 호출로 입력합니다.
product.displayPrice = 29900.0;
product.taxType = 1; // int 필드라 비우면 0 으로 나갑니다 — 1 과세 · 2 복합과세 · 3 면세 · 4 영세
product.externalUid = "shop-coffee-10"; // external_uid 로 나갑니다 (ex_uid 와 같은 값)
product.statusDisplay = true;
product.statusSale = true;
BootpayStoreResponse response = commerce.product.create(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_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 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 · save_by · status_visible 칸이 없어 범용 Post 로 보냅니다
response, err := commerce.Post("products", 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, err)using Bootpay.Commerce;
using System.Net.Http;
var commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
// .NET SDK 의 CommerceProduct 에는 desc · save_by · status_* 속성이 없어 SendAsync 로 보냅니다
var response = await commerce.SendAsync("products", HttpMethod.Post, 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(await response.Content.ReadAsStringAsync());응답
성공 응답
JSON
{
"product_id": "67c95e64d01640bb9859c629",
"save_by": 3
}에러 응답
HTTP/1.1 409 Conflict
Content-Type: application/jsonJSON
{
"error_code": "PRODUCT_PRICE_INVALID",
"message": "상품가격은 0원 이상이어야 합니다."
}에러 코드
오류 코드
| 코드 | 메시지 | 대처 방법 |
|---|---|---|
PRODUCT_PRICE_INVALID | 상품가격은 0원 이상이어야 합니다. (HTTP 409) | display_price 를 0보다 큰 값으로 보냅니다. 0원은 사용량 기반·수시결제 구독 상품만 허용됩니다 |