Orders
Orders, order products, returns, exchanges, fulfillments, and payment transaction collections
Orders
orders
Stores order information.
| Field | Type | Description | Required |
|---|---|---|---|
orderNumber | text | Order number (unique, read-only) | ✓ |
status | select | Order status (default: pending, read-only) | ✓ |
customer | relationship | Customer reference (customers) | |
customerSnapshot | group | Customer info at time of order (read-only) | |
totalAmount | number | Total payment amount (read-only) | |
discountCode | text | Discount code (read-only) | |
discountAmount | number | Discount amount (read-only) | |
notes | textarea | Notes | |
shippingAddress | group | Shipping address (read-only) | |
products | join | Order products (order-products) | |
transactions | join | Payment history (transactions) | |
returns | join | Return history (returns) | |
exchanges | join | Exchange history (exchanges) | |
fulfillments | join | Fulfillment history (fulfillments) |
Customer Snapshot (customerSnapshot):
| Field | Type | Description | Required |
|---|---|---|---|
name | text | Customer name | |
email | |||
phone | text | Phone number |
Shipping Address (shippingAddress):
| Field | Type | Description | Required |
|---|---|---|---|
recipientName | text | Recipient name | |
phone | text | Phone number | |
postalCode | text | Postal code | |
address1 | text | Address | |
address2 | text | Detailed address | |
deliveryMessage | text | Delivery message |
Order Status Flow:
Payment: pending → paid → failed / canceled
Shipping: preparing → shipped → delivered → confirmed
Returns: return_requested → return_processing → returnedconst response = await client.from('orders').find({
where: { status: { equals: 'paid' } },
sort: '-createdAt'
})order-products
Stores products included in an order. All fields are read-only.
| Field | Type | Description | Required |
|---|---|---|---|
order | relationship | Order reference (orders) | ✓ |
product | relationship | Product reference (products) | ✓ |
variant | relationship | Variant reference (product-variants) | |
option | relationship | Option reference (product-options) | |
quantity | number | Quantity | ✓ |
unitPrice | number | Unit price at time of order | ✓ |
totalPrice | number | unitPrice × quantity | ✓ |
returns
Stores return requests.
| Field | Type | Description | Required |
|---|---|---|---|
order | relationship | Order reference (orders, read-only) | ✓ |
status | select | Return status (default: requested) | ✓ |
reason | select | Return reason | |
reasonDetail | textarea | Detailed reason | |
returnProducts | join | Return products (return-products) | |
refundAmount | number | Refund amount (read-only) | ✓ |
Return Statuses: requested, processing, approved, rejected, completed
Return Reasons: change_of_mind, defective, wrong_delivery, damaged, other
return-products
Stores individual return product items.
| Field | Type | Description | Required |
|---|---|---|---|
return | relationship | Return reference (returns, hidden) | ✓ |
order | relationship | Order reference (hidden, read-only) | ✓ |
status | select | Status: requested, processing, approved, rejected | ✓ |
orderProduct | relationship | Order product reference (order-products) | ✓ |
product | relationship | Product reference (hidden, auto-set) | ✓ |
variant | relationship | Variant reference (hidden, auto-set) | ✓ |
option | relationship | Option reference (hidden, auto-set) | ✓ |
quantity | number | Return quantity | ✓ |
exchanges
Stores exchange requests.
| Field | Type | Description | Required |
|---|---|---|---|
order | relationship | Order reference (orders, read-only) | ✓ |
status | select | Exchange status (default: requested) | ✓ |
reason | select | Exchange reason | |
reasonDetail | textarea | Detailed reason | |
shippingFee | number | Exchange shipping fee (default: 0) | |
exchangeProducts | join | Exchange products (exchange-products) |
Exchange Statuses: requested, processing, shipped, completed, rejected
Exchange Reasons: wrong_size, wrong_color, defective, other
const response = await client.from('exchanges').find({
where: {
order: { equals: orderId },
status: { equals: 'requested' }
}
})exchange-products
Stores individual exchange product items.
| Field | Type | Description | Required |
|---|---|---|---|
exchange | relationship | Exchange reference (exchanges, read-only) | ✓ |
order | relationship | Order reference (hidden, auto-set) | |
orderProduct | relationship | Order product reference (order-products) | ✓ |
product | relationship | Product reference (hidden, auto-set) | |
variant | relationship | Variant reference (hidden, auto-set) | |
option | relationship | Option reference (hidden, auto-set) | |
quantity | number | Exchange quantity | ✓ |
newVariant | relationship | Desired new variant (product-variants) | |
newOption | relationship | Desired new option (product-options) |
fulfillments
Stores fulfillment (shipping) information. Supports partial and split shipments.
| Field | Type | Description | Required |
|---|---|---|---|
order | relationship | Order reference (orders) | ✓ |
status | select | Fulfillment status (default: pending) | ✓ |
carrier | select | Shipping carrier | |
trackingNumber | text | Tracking number | |
shippedAt | date | Shipped date | |
deliveredAt | date | Delivered date | |
items | join | Fulfillment items (fulfillment-items) |
Fulfillment Statuses: pending, packed, shipped, delivered, failed
Shipping Carriers: cj, hanjin, lotte, epost, logen, other
const response = await client.from('fulfillments').find({
where: {
order: { equals: orderId },
status: { not_equals: 'delivered' }
}
})fulfillment-items
Stores items included in a fulfillment.
| Field | Type | Description | Required |
|---|---|---|---|
fulfillment | relationship | Fulfillment reference (fulfillments) | ✓ |
orderProduct | relationship | Order product reference (order-products) | ✓ |
quantity | number | Fulfillment quantity | ✓ |
transactions
Stores payment transactions. All fields are read-only.
| Field | Type | Description | Required |
|---|---|---|---|
status | select | Status: pending, paid, failed, canceled | ✓ |
order | relationship | Order reference (orders) | ✓ |
paymentId | text | Payment ID | |
paymentMethod | text | Payment method | |
receiptUrl | text | Receipt URL | |
totalAmount | number | Payment amount |