E-shop
Products, orders, checkout, and payment processing
The E-shop module provides complete e-commerce functionality including product management, order processing, and checkout.
Products
Create Product
POST
/v1/businesses/{businessId}/products SDK:
sdk.eshop.createProduct() Create a new product.
const result = await sdk.eshop.createProduct({
key: 'premium-widget',
description: 'A high-quality widget for all your needs',
nodeIds: ['node_widgets', 'node_premium'],
blocks: [
{
key: 'details',
type: 'TEXT',
content: {
body: { en: 'Product specifications...' }
}
}
],
variants: [
{
sku: 'WIDGET-SM',
prices: [{ market: 'USD', amount: 2999 }],
stock: 100,
attributes: [],
weight: 500
},
{
sku: 'WIDGET-LG',
prices: [{ market: 'USD', amount: 3999 }],
stock: 50,
attributes: [],
weight: 750
}
],
status: 'ACTIVE'
});Parameters
| Name | Type | Description |
|---|---|---|
key required | string | Unique product key identifier |
slug optional | Record<string, string> | Locale-keyed URL slugs (e.g., {en: 'my-product'}) |
access optional | PUBLIC | AUTHENTICATED | PRIVATE | Access level for the product |
nodeIds optional | string[] | Category/collection node IDs |
networkIds optional | string[] | Network IDs the product belongs to |
blocks optional | Block[] | Content blocks for product details |
variants optional | Variant[] | Product variants (sku, prices, stock, attributes, weight) |
status optional | DRAFT | ACTIVE | ARCHIVED | Product status |
Get Product
GET
/v1/businesses/{businessId}/products/{id} SDK:
sdk.eshop.getProduct() Retrieve a product by ID or slug.
// By ID
const result = await sdk.eshop.getProduct({
id: 'prod_xyz789'
});
// By slug (locale-aware)
const result = await sdk.eshop.getProduct({
slug: 'premium-widget'
});
Parameters
| Name | Type | Description |
|---|---|---|
id optional | string | Product ID (use this OR slug) |
slug optional | string | Product slug (locale-aware lookup) |
List Products
GET
/v1/businesses/{businessId}/products SDK:
sdk.eshop.getProducts() List products with filtering and pagination.
const result = await sdk.eshop.getProducts({
ids: ['prod_1', 'prod_2'],
nodeIds: ['node_widgets'],
nodeId: 'node_featured',
blocks: ['details', 'specs'],
status: 'ACTIVE',
statuses: ['ACTIVE', 'DRAFT'],
query: 'premium',
sortField: 'createdAt',
sortDirection: 'desc',
cursor: null,
limit: 20,
createdAtFrom: 1704067200,
createdAtTo: 1706745600
});
const { items, cursor } = result;
items.forEach(product => {
console.log(product.key, product.variants);
});Parameters
| Name | Type | Description |
|---|---|---|
ids optional | string[] | Filter by specific product IDs |
nodeIds optional | string[] | Filter by category/collection nodes |
nodeId optional | string | Filter by single node |
blocks optional | Block[] | Filter by blocks content |
matchAll optional | boolean | If true, match all block filters (AND); if false, match any (OR) |
status optional | string | Filter by status |
statuses optional | string[] | Filter by multiple statuses |
query optional | string | Search query in product content |
sortField optional | string | Sort field (createdAt, updatedAt, etc.) |
sortDirection optional | asc | desc | Sort direction |
cursor optional | string | Pagination cursor |
limit optional | number | Items per page (max 100) |
createdAtFrom optional | number | Filter by creation date (Unix timestamp) |
createdAtTo optional | number | Filter by creation date (Unix timestamp) |
Update Product
PUT
/v1/businesses/{businessId}/products/{id} SDK:
sdk.eshop.updateProduct() Update an existing product.
const result = await sdk.eshop.updateProduct({
id: 'prod_xyz789',
key: 'updated-widget',
slug: { en: 'updated-widget', es: 'widget-actualizado' },
access: 'PUBLIC',
nodeIds: ['node_widgets', 'node_sale'],
networkIds: [],
blocks: [/* updated blocks */],
variants: [
{
id: 'var_existing',
sku: 'WIDGET-SM-V2',
prices: [{ market: 'USD', amount: 3499 }],
stock: 150,
attributes: [],
weight: 500
}
],
status: 'ACTIVE'
});
Parameters
| Name | Type | Description |
|---|---|---|
id required | string | Product ID to update |
key required | string | Product key identifier |
slug optional | Record<string, string> | Locale-keyed URL slugs |
access optional | PUBLIC | AUTHENTICATED | PRIVATE | Access level |
nodeIds optional | string[] | Category/collection node IDs |
networkIds optional | string[] | Network IDs |
blocks optional | Block[] | Content blocks |
variants optional | Variant[] | Product variants (id, sku, prices, stock, attributes, weight) |
status optional | DRAFT | ACTIVE | ARCHIVED | Product status |
Delete Product
DELETE
/v1/businesses/{businessId}/products/{id} SDK:
sdk.eshop.deleteProduct() Delete a product.
await sdk.eshop.deleteProduct({
id: 'prod_xyz789'
});
Orders
Create Order
POST
/v1/businesses/{businessId}/orders SDK:
sdk.eshop.createOrder() Create a new order without payment processing (use checkout for payment).
const result = await sdk.eshop.createOrder({
market: 'USD',
items: [
{ productId: 'prod_xyz789', variantId: 'var_small', quantity: 2 },
{ productId: 'prod_abc456', variantId: 'var_default', quantity: 1 }
],
blocks: [
{
key: 'shipping-notes',
type: 'TEXT',
content: { body: 'Leave at door' }
}
]
});
Parameters
| Name | Type | Description |
|---|---|---|
market required | string | Market/currency code (e.g., USD, EUR) |
items required | CheckoutItem[] | Order items (productId, variantId, quantity) |
blocks required | Block[] | Order content blocks |
Get Order
GET
/v1/businesses/{businessId}/orders/{id} SDK:
sdk.eshop.getOrder() Retrieve an order by ID.
const order = await sdk.eshop.getOrder({
id: 'ord_xyz789'
});
console.log(order.status, order.total, order.items);
List Orders
GET
/v1/businesses/{businessId}/orders SDK:
sdk.eshop.getOrders() List orders with filtering.
const result = await sdk.eshop.getOrders({
accountId: 'acc_customer123',
statuses: ['CONFIRMED', 'SHIPPED'],
productIds: ['prod_xyz789'],
query: '[email protected]',
sortField: 'createdAt',
sortDirection: 'desc',
cursor: null,
limit: 50,
createdAtFrom: '2024-01-01',
createdAtTo: '2024-12-31'
});
result.items.forEach(order => {
console.log(order.id, order.status, order.total);
});Parameters
| Name | Type | Description |
|---|---|---|
accountId optional | string | Filter by customer account |
statuses optional | string[] | Filter by statuses: CREATED, PENDING, AUTHORIZED, CONFIRMED, SHIPPED, COMPLETED, CANCELLED, FAILED |
productIds optional | string[] | Filter by products in order |
query optional | string | Search query |
sortField optional | string | Sort field |
sortDirection optional | asc | desc | Sort direction |
cursor optional | string | Pagination cursor |
limit optional | number | Items per page |
createdAtFrom optional | string | Filter by creation date (start) |
createdAtTo optional | string | Filter by creation date (end) |
Update Order
PUT
/v1/businesses/{businessId}/orders/{id} SDK:
sdk.eshop.updateOrder() Update order status or details.
await sdk.eshop.updateOrder({
id: 'ord_xyz789',
status: 'SHIPPED',
blocks: [
{
key: 'tracking',
type: 'TEXT',
content: { body: 'Tracking: 1Z999AA10123456784' }
}
],
items: [
{ productId: 'prod_xyz', variantId: 'var_1', quantity: 2 }
],
payment: {
// Optional payment update
}
});Parameters
| Name | Type | Description |
|---|---|---|
id required | string | Order ID to update |
status required | string | Order status: CREATED, PENDING, AUTHORIZED, CONFIRMED, SHIPPED, COMPLETED, CANCELLED, FAILED |
blocks required | Block[] | Order content blocks |
items required | CheckoutItem[] | Order items (productId, variantId, quantity) |
payment optional | Payment | Payment object update |
Checkout
Get Quote
POST
/v1/businesses/{businessId}/orders/quote SDK:
sdk.eshop.getQuote() Calculate order total before checkout.
const quote = await sdk.eshop.getQuote({
items: [
{ productId: 'prod_xyz789', variantId: 'var_small', quantity: 2 }
],
paymentMethodId: 'pm_card_visa',
shippingMethodId: 'ship_standard',
promoCode: 'SAVE10',
blocks: [
{
key: 'gift-message',
type: 'TEXT',
content: { body: 'Happy Birthday!' }
}
]
});
console.log('Subtotal:', quote.subtotal);
console.log('Discount:', quote.discount);
console.log('Shipping:', quote.shipping);
console.log('Tax:', quote.tax);
console.log('Total:', quote.total);Parameters
| Name | Type | Description |
|---|---|---|
items required | EshopItem[] | Cart items with productId, variantId, and quantity |
paymentMethodId optional | string | Payment method for fee calculation |
shippingMethodId optional | string | Shipping method for rate calculation |
promoCode optional | string | Promo code for discount |
blocks optional | Block[] | Additional order blocks |
Checkout
POST
/v1/businesses/{businessId}/orders/checkout SDK:
sdk.eshop.checkout() Process payment and complete order.
const result = await sdk.eshop.checkout({
items: [
{ productId: 'prod_xyz789', variantId: 'var_small', quantity: 2 }
],
paymentMethodId: 'pm_card_visa',
shippingMethodId: 'ship_standard', // Required
blocks: [
{
key: 'customer-info',
type: 'FORM',
content: {
email: '[email protected]',
firstName: 'John',
lastName: 'Doe'
}
}
],
promoCodeId: 'promo_save10'
});
if (result.requiresAction) {
// 3D Secure required
window.location.href = result.redirectUrl;
} else {
// Payment complete
console.log('Order placed:', result.order);
}Parameters
| Name | Type | Description |
|---|---|---|
items required | EshopItem[] | Cart items with productId, variantId, and quantity |
shippingMethodId required | string | Selected shipping method |
paymentMethodId optional | string | Payment method from Stripe |
blocks optional | Block[] | Additional order blocks (customer info, notes, etc.) |
promoCodeId optional | string | Applied promo code ID |
Complete Checkout Flow
import { loadStripe } from '@stripe/stripe-js';
const stripe = await loadStripe('pk_live_xxx');
async function checkout(cart: CartItem[]) {
// 1. Get quote to show prices
const quote = await sdk.eshop.getQuote({
items: cart.map(item => ({
productId: item.productId,
variantId: item.variantId,
quantity: item.quantity
})),
shippingMethodId: selectedShipping,
promoCode: promoCodeInput
});
console.log('Total:', quote.total);
// 2. Create Stripe payment method
const { paymentMethod, error } = await stripe.createPaymentMethod({
type: 'card',
card: cardElement,
billing_details: {
email: customerEmail
}
});
if (error) {
throw new Error(error.message);
}
// 3. Checkout
const result = await sdk.eshop.checkout({
items: cart.map(item => ({
productId: item.productId,
variantId: item.variantId,
quantity: item.quantity
})),
paymentMethodId: paymentMethod.id,
shippingMethodId: selectedShipping,
blocks: [
{
key: 'customer',
type: 'FORM',
content: {
email: customerEmail,
firstName: customerFirstName,
lastName: customerLastName,
address: shippingAddress
}
}
],
promoCodeId: appliedPromoId
});
if (result.requiresAction) {
// Handle 3D Secure
const { error } = await stripe.confirmCardPayment(
result.clientSecret
);
if (error) throw new Error(error.message);
}
return result.order;
}
Tip
Use the getQuote endpoint to show price breakdowns before the customer commits to purchase.