@orchestree/commerce
v1.3.0
Published
Commerce module — Storefront builder, checkout flow, subscriptions, marketplace, inventory
Maintainers
Readme
@orchestree/commerce
E-commerce platform for Orchestree. Build storefronts, manage inventory, process checkouts, and handle subscriptions.
Installation
npm install @orchestree/commerceQuick Start
const { CommerceClient } = require('@orchestree/commerce');
const client = new CommerceClient({
apiKey: 'your-api-key',
});
// Create a product
const product = await client.createProduct({
name: 'Premium Widget',
sku: 'WIDGET-001',
price: 29.99,
inventory: 100,
});
// Process checkout
const order = await client.processCheckout(
[{ productId: product.id, quantity: 2, price: 29.99 }],
{ email: '[email protected]', name: 'John Doe' }
);
// Create subscription
const subscription = await client.createSubscription({
customerId: 'cust-123',
productId: product.id,
billingCycle: 'monthly',
});API Reference
CommerceClient
createProduct(productDef)
Create a new product.
const product = await client.createProduct({
name: 'Widget',
sku: 'WDG-001',
price: 19.99,
inventory: 50,
});processCheckout(cartItems, customerInfo)
Process a checkout.
const order = await client.processCheckout(
[{ productId: 'prod-123', quantity: 1, price: 19.99 }],
{ email: '[email protected]' }
);createSubscription(subscriptionDef)
Create a subscription.
const sub = await client.createSubscription({
customerId: 'cust-123',
productId: 'prod-456',
billingCycle: 'monthly',
});getOrders(filters)
List orders.
const orders = await client.getOrders({ status: 'delivered' });updateInventory(productId, quantity)
Update product inventory.
await client.updateInventory('prod-123', 75);License
MIT
