Create Order
This page describes the request data identifiers and response structure required to create an order.
Data Identifier
{
"dataID": "CREATE_ORDER",
"source": "STOREFRONT",
"currency": "KRW",
"payment_status": "UNPAID",
"shipping_total": 3000,
"discount_total": 0,
"tax_total": 0,
"customer_snapshot": {
"name": "Jane Kim",
"email": "jane.kim@example.com",
"phone": "010-0000-0000"
},
"shipping_snapshot": {
"receiver": "Jane Kim",
"zipcode": "06236",
"address1": "123 Teheran-ro, Gangnam-gu, Seoul",
"address2": "Apt 101"
},
"order_extra_data": {
"memo": "Leave at the door"
},
"items": [
{
"product_seq": 340,
"quantity": 2,
"selections": [
{ "set_seq": 12, "variant_seq": 5001 }
]
}
]
}
| Key | Description |
|---|---|
| dataID | Data identifier CREATE_ORDER |
| source | Order channel. A-Z and _, up to 32 (default STOREFRONT) |
| customer_seq | Member number (empty for guests) |
| currency | 3-letter currency. Default KRW |
| payment_status | Payment status. Default UNPAID |
| shipping_total | Shipping fee (0 or more) |
| discount_total | Discount (0 or more) |
| tax_total | Tax (0 or more) |
| customer_snapshot | Customer JSON object (name, email, phone) |
| shipping_snapshot | Shipping address JSON object |
| order_extra_data | Extra data JSON object |
| admin_note | Admin note (hidden from customers) |
| items | Order items (1 to 200) |
| items[n].product_seq | Product number (ACTIVE only) |
| items[n].quantity | Quantity 1 to 9999 |
| items[n].selections | Chosen options [{set_seq, variant_seq}] |
| items[n].text_inputs | Text inputs [{field_seq, value}] |
| items[n].unit_price | Optional. Must equal the server price |
HTML
<div class="card">
<div class="card-header fw-bold">Checkout</div>
<table class="table align-middle mb-0">
<thead><tr><th>Item</th><th class="text-end">Qty</th><th class="text-end">Amount</th></tr></thead>
<tbody>
<tr v-for="i in quote.items">
<td>
<span v-for="o in i.options">{{ o.set_label }}: {{ o.option_text }}</span>
<div v-if="!i.result" class="small text-danger">{{ i.error_message }}</div>
</td>
<td class="text-end">{{ i.quantity }}</td>
<td class="text-end">{{ i.line_total }}</td>
</tr>
</tbody>
<tfoot>
<tr><td colspan="2" class="text-end">Items</td><td class="text-end">{{ quote.item_subtotal }}</td></tr>
</tfoot>
</table>
<div class="card-body">
<button class="btn btn-primary" :disabled="!quote.all_ok">Place order</button>
</div>
</div>
Response Result
{
"result": true,
"result_code": 200,
"order_seq": 123,
"order_no": "ORD-20261004-CAA73C",
"order_key": "E477FEEBAABBCCDD208AFC505D20C022",
"grand_total": 41000
}
| Key | Description |
|---|---|
| result | Created or not (true / false) |
| result_code | 200 on success |
| order_seq | Order number (admin use) |
| order_no | Order no ORD-YYYYMMDD-XXXXXX |
| order_key | Order key (use in page URLs) |
| grand_total | Amount to pay |
- Screen example (cart to order): store only product_seq, quantity and selections in the cart. On the checkout page call QUOTE_ORDER for prices and stock, then send the same items to CREATE_ORDER. On success, go to the order-complete page with order_key.
- Quote QUOTE_ORDER: send currency and items (up to 100). It returns all_ok, currency, items[] (index, result, product_seq, variant_seq, sku, quantity, unit_price, line_total, options[{set_label, option_text, price_delta}], stock{tracked, available, enough}), item_subtotal and quantity_total. Nothing is saved; sign-in is required.
- If any quote item fails, all_ok and result are false and the first failure's error_code and error_message are returned (409 when sold out). The failed item has items[n].result:false and an error_message.
- The server builds unit price, product name, SKU, option_snapshot and product_snapshot from the database; client values are ignored. grand_total = item subtotal + shipping_total + tax_total − discount_total.
- payment_status: UNPAID / PENDING / PAID / FAILED / REFUND_PENDING / PARTIALLY_REFUNDED / REFUNDED. Any other value returns 400.
- Use name, email and phone keys in customer_snapshot; the order list reads them for customer_name, customer_phone and search. Snapshots may be sent as a JSON object or a JSON string.
- Stock: placing an order reserves stock (quantity_reserved). SHIPPED takes it from both on-hand and reserved, CANCELLED before shipping releases the reservation, and RETURNED (or CANCELLED) after shipping restocks it. The server does this in the same transaction.
- Error codes — errors also come back as HTTP 200. Check result:false, then error_code (string) and error_message.
- 401 — Login required. Every order API needs a signed-in session.
- 400 — No items (Order requires at least one item), more than 200 items, a product not on sale, a required option not chosen, an invalid payment_status, source or currency, or a discount larger than the total.
- 409 — Sold-out option, not enough stock, or unit_price differs from the server price (unit price mismatch). The items[n] prefix in the message points at the item.
Example
<script setup>
import { ref } from 'vue'
// The cart keeps only product_seq, quantity and selections (see Product detail).
// Price, option text and stock are always recalculated by the server.
const cart = ref([
{ product_seq: 340, quantity: 2, selections: [{ set_seq: 12, variant_seq: 5001 }] }
])
const shippingTotal = 3000
const quote = ref(null)
const done = ref(null)
const error = ref('')
const money = v => new Intl.NumberFormat('ko-KR').format(v)
// 1) Checkout page: ask the server for prices and stock
async function loadQuote() {
const { output } = await useNuxtApp().$connector({ dataID: 'QUOTE_ORDER', currency: 'KRW', items: cart.value })
quote.value = output
error.value = output.all_ok ? '' : output.error_message // e.g. sold out -> 409
}
// 2) Place order: send the same items again
async function placeOrder() {
const { output } = await useNuxtApp().$connector({
dataID: 'CREATE_ORDER', source: 'STOREFRONT', currency: 'KRW', payment_status: 'UNPAID',
shipping_total: shippingTotal,
customer_snapshot: { name: 'Jane Kim', email: 'jane.kim@example.com', phone: '010-0000-0000' },
shipping_snapshot: { receiver: 'Jane Kim', zipcode: '06236', address1: '123 Teheran-ro, Gangnam-gu, Seoul', address2: 'Apt 101' },
items: cart.value
})
if (output.result) done.value = output // { order_no, order_key, grand_total }
else error.value = output.error_message
}
await loadQuote()
</script>
<template>
<div class="card">
<div class="card-header fw-bold">Checkout</div>
<table class="table align-middle mb-0" v-if="quote">
<thead><tr><th>Item</th><th class="text-end">Qty</th><th class="text-end">Amount</th></tr></thead>
<tbody>
<tr v-for="i in quote.items" :key="i.index">
<td>
<span v-for="o in i.options" :key="o.set_label">{{ o.set_label }}: {{ o.option_text }}</span>
<div v-if="!i.result" class="small text-danger">{{ i.error_message }}</div>
</td>
<td class="text-end">{{ i.quantity }}</td>
<td class="text-end">{{ i.result ? money(i.line_total) : '-' }}</td>
</tr>
</tbody>
<tfoot>
<tr><td colspan="2" class="text-end">Items</td><td class="text-end">{{ money(quote.item_subtotal) }}</td></tr>
<tr><td colspan="2" class="text-end">Shipping</td><td class="text-end">{{ money(shippingTotal) }}</td></tr>
<tr class="fw-bold"><td colspan="2" class="text-end">Total</td><td class="text-end">{{ money(quote.item_subtotal + shippingTotal) }} KRW</td></tr>
</tfoot>
</table>
<div class="card-body">
<p v-if="error" class="text-danger">{{ error }}</p>
<button class="btn btn-primary" :disabled="!quote || !quote.all_ok" @click="placeOrder">Place order</button>
<p v-if="done" class="mt-3 mb-0">Order {{ done.order_no }} placed. Total {{ money(done.grand_total) }} KRW</p>
</div>
</div>
</template>
<?php
// Cart items: only product_seq, quantity and selections. The server sets price and snapshots.
$items = [
['product_seq' => 340, 'quantity' => 2, 'selections' => [['set_seq' => 12, 'variant_seq' => 5001]]],
];
// 1) Quote: prices and stock before payment
$quote = $connector->request(['dataID' => 'QUOTE_ORDER', 'currency' => 'KRW', 'items' => $items]);
if (!$quote['all_ok']) {
echo '<p class="text-danger">' . htmlspecialchars($quote['error_message']) . '</p>'; // e.g. sold out (409)
return;
}
// 2) Create
$output = $connector->request([
'dataID' => 'CREATE_ORDER',
'source' => 'STOREFRONT',
'currency' => 'KRW',
'payment_status' => 'UNPAID',
'shipping_total' => 3000,
'customer_snapshot' => ['name' => 'Jane Kim', 'email' => 'jane.kim@example.com', 'phone' => '010-0000-0000'],
'shipping_snapshot' => ['receiver' => 'Jane Kim', 'zipcode' => '06236', 'address1' => '123 Teheran-ro, Gangnam-gu, Seoul', 'address2' => 'Apt 101'],
'items' => $items,
]);
if ($output['result']) {
header('Location: /mypage/order?order_key=' . $output['order_key']);
} else {
echo '<p class="text-danger">' . htmlspecialchars($output['error_message']) . '</p>';
}
User Discussions
ADD- There are no posts yet.