판매할 상품 정보를 등록해요. 가격, 이름, 구독 설정 등을 지정해요.
기존에 운영 중이던 상품 정보를 등록하는 API예요. 이전 시스템의 상품 데이터를 이전하거나, 오프라인/제휴 유입 상품을 등록할 때 사용해요.
API 엔드포인트
POST
https://api.bootapi.com/v1/productsBasic Auth요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
name |
String | 필수 | 상품명 |
desc |
String | 선택 | 상품 요약 설명 |
content |
String | 선택 | 상품 상세 설명 (HTML 지원) |
images |
Array | 선택 | 상품 이미지 URL 배열 (첫 번째가 대표) |
category_id |
String | 선택 | 카테고리 ID |
display_price |
Integer | 필수 | 판매가 (표시가) |
tax_free_price |
Integer | 선택 | 비과세 가격 |
use_stock |
Boolean | 선택 | 재고 관리 사용 여부 |
stock |
Integer | 선택 | 재고 수량 |
use_subscription |
Boolean | 선택 | 구독 상품 여부 |
subscription_setting_id |
String | 선택 | 구독 설정 템플릿 ID |
use_discount |
Boolean | 선택 | 할인 사용 여부 |
discount_price |
Integer | 선택 | 할인가 |
status_display |
Boolean | 선택 | 쇼핑몰 노출 여부 |
status_sale |
Boolean | 선택 | 판매 상태 |
ex_uid |
String | 선택 | 외부 시스템 고유 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: 'Professional 플랜',
desc: '전문가를 위한 구독 서비스',
display_price: 29900,
use_subscription: true,
subscription_setting_id: 'subscription_setting_123',
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='Professional 플랜',
desc='전문가를 위한 구독 서비스',
display_price=29900,
use_subscription=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' => 'Professional 플랜',
'desc' => '전문가를 위한 구독 서비스',
'display_price' => 29900,
'use_subscription' => 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 java.util.HashMap;
TokenPayload tp = new TokenPayload("your-commerce-client-key", "your-commerce-secret-key");
BootpayStore commerce = new BootpayStore(tp);
HashMap<String, Object> params = new HashMap<>();
params.put("name", "Professional 플랜");
params.put("desc", "전문가를 위한 구독 서비스");
params.put("display_price", 29900);
params.put("use_subscription", true);
params.put("status_display", true);
params.put("status_sale", true);
HashMap<String, Object> response = commerce.productCreate(params);
System.out.println(response);javacommerce = BootpayStore::Api.new('your-commerce-client-key', 'your-commerce-secret-key')
response = commerce.product_create(
name: 'Professional 플랜',
desc: '전문가를 위한 구독 서비스',
display_price: 29900,
use_subscription: 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": "Professional 플랜",
"desc": "전문가를 위한 구독 서비스",
"display_price": 29900,
"use_subscription": 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 = "Professional 플랜",
desc = "전문가를 위한 구독 서비스",
display_price = 29900,
use_subscription = true,
status_display = true,
status_sale = true
});
Console.WriteLine(response);csharp응답
성공 응답
{
"product_id": "67c95e64d01640bb9859c629"
}json에러 응답
{
"status": 400,
"code": 1505,
"message": "상품명이 비어있습니다.",
"data": null
}json에러 코드
공통 에러
인증·권한 관련 에러는 에러 코드표를 참고해요.
| 코드 | 메시지 | 대처 방법 |
|---|---|---|
PRODUCT_NAME_BLANK |
상품명이 비어있어요 | name을 입력해요 |
PRODUCT_PRICE_INVALID |
상품가격은 0원 이상이어야 해요. | price 값을 확인해요 |
PRODUCT_OPTION_LENGTH_INVALID |
상품 옵션 정보와 옵션 키 길이 정보가 일치하지 않아요. 상품옵션을 다시 생성 후 시도해요 | 옵션 배열 길이를 맞춰요 |
product_id는 주문서 요청 시 products[].product_id에 사용돼요.
