Skip to main content

Introduction

๐ŸŽฏ What does this module do?โ€‹

The Orders module lets you create, manage, and track customer orders - from shopping cart checkout to payment processing and order fulfillment - handling the complete e-commerce order lifecycle.

Think of it as your order management system - customers add items to cart, place orders, make payments, and you track everything from order creation to delivery, all within OneEntry.


๐Ÿ“– Simple Explanationโ€‹

Every e-commerce application needs order management:

  • ๐Ÿ›’ Shopping Cart - Users add products, proceed to checkout
  • ๐Ÿ“‹ Order Creation - Convert cart to order with customer details
  • ๐Ÿ’ณ Payment Processing - Accept payments (credit card, PayPal, etc.)
  • ๐Ÿ“ฆ Order Tracking - Track status (pending, processing, shipped, delivered)
  • ๐Ÿ“Š Order Management - View all orders, filter by status, search
  • ๐Ÿงพ Order Details - View line items, totals, customer info

Issues:

  • ๐Ÿ”’ No payment integration - Manual payment tracking
  • ๐Ÿ“Š Poor tracking - Hard to find orders, filter by status
  • ๐Ÿ”„ No automation - Manual status updates, no notifications
  • ๐Ÿ’ธ No tax/shipping calculation - Calculate manually

The Orders solution:

Benefits:

  • ๐Ÿ”’ Integrated payments - Stripe, PayPal, other gateways
  • ๐Ÿ“Š Advanced tracking - Filter, search, export orders
  • ๐Ÿ”„ Automated workflows - Status updates, notifications
  • ๐Ÿ’ธ Auto-calculations - Tax, shipping, discounts

โœจ Key Conceptsโ€‹

What is an Order?โ€‹

An Order is a customer purchase transaction containing:

  • Order Items - Products/services being purchased (quantity, price)
  • Customer Information - Name, email, phone
  • Shipping Address - Delivery location
  • Billing Address - Payment billing info
  • Payment Details - Payment method, transaction ID
  • Order Totals - Subtotal, tax, shipping, total
  • Order Status - Current state (pending, processing, completed)
  • Timestamps - Created, updated, completed dates

Order Structureโ€‹

Each order has this structure:

{
id: 179,
storageId: 1,
createdDate: '2025-07-03T00:43:02.908Z',
statusIdentifier: 'inProgress',
formIdentifier: 'orderForm',
formData: [
{
marker: 'order_name',
type: 'string',
value: 'Ivan'
}
],
attributeSetIdentifier: 'order_form',
totalSum: '300.00',
currency: 'USD',
paymentAccountIdentifier: 'cash',
paymentAccountLocalizeInfos: { title: 'Cash' },
products: [
{
id: 2957,
title: 'Cosmo',
sku: null,
previewImage: null,
price: 150,
quantity: 2,
},
],
isCompleted: true,
}

Order Lifecycleโ€‹

1. Customer adds items to cart
โ†“
2. Proceeds to checkout
โ†“
3. Enters shipping/billing info
โ†“
4. Selects payment method
โ†“
5. Order created (status: pending)
โ†“
6. Payment processed (status: processing)
โ†“
7. Order confirmed (status: confirmed)
โ†“
8. Items prepared (status: processing)
โ†“
9. Order shipped (status: shipped)
โ†“
10. Order delivered (status: completed)

Order Statuses examplesโ€‹

StatusMeaningWhen to Use
pendingOrder created, awaiting paymentJust placed, payment not processed
processingPayment received, preparing itemsPayment confirmed, packing items
confirmedOrder confirmed, ready to shipPayment cleared, order verified
shippedOrder dispatched to customerPackage sent via carrier
deliveredOrder received by customerDelivery confirmed
completedOrder finished, no action neededTransaction complete
cancelledOrder cancelledCustomer/admin cancelled
refundedPayment returned to customerRefund processed
failedPayment or processing failedPayment declined

Common Order Operationsโ€‹

OperationDescriptionExample Use Case
Create OrderConvert cart to orderCheckout button clicked
Get OrdersList all orders (paginated)Admin dashboard
Get Order by IDFetch specific orderView order details
Update StatusChange order statusMark as shipped
Calculate TotalsCompute tax, shipping, totalCheckout summary
Cancel OrderCancel pending orderCustomer requests cancellation
Refund OrderReturn payment to customerProduct return

Why Use Orders Module?โ€‹

BenefitDescription
Automated Order ManagementNo manual tracking, everything automated
Payment IntegrationStripe, PayPal, other gateways built-in
Status TrackingReal-time order status updates
Customer NotificationsAuto-send order confirmations, shipping updates
Inventory ManagementAuto-deduct stock on order
Analytics & ReportingSales reports, revenue tracking
SecurityPCI-compliant payment processing

๐Ÿ“‹ What You Need to Knowโ€‹

Orders are Created from Cart Dataโ€‹

You need to provide:

  1. Customer information - Name, email, phone
  2. Order items - Products, quantities, prices
  3. Shipping address - Delivery location
  4. Payment method - How customer will pay

Order Status Managementโ€‹

Track order progress through statuses:

Common status flows:

  • Digital products: pending โ†’ processing โ†’ completed
  • Physical products: pending โ†’ processing โ†’ shipped โ†’ delivered โ†’ completed
  • Cancelled: any status โ†’ cancelled
  • Refunded: completed โ†’ refunded

Payment Processingโ€‹

Orders integrate with payment gateways


๐Ÿ’ก Important Notesโ€‹

Orders are Created in OneEntryโ€‹

The Orders module handles the complete order lifecycle:

  • โœ… Create orders from cart data
  • โœ… Process payments
  • โœ… Update order status
  • โœ… Track shipping
  • โŒ Does NOT handle shopping cart UI (you build that)

Your responsibility:

  • Build shopping cart interface
  • Collect customer information
  • Display order confirmation

Payment Processingโ€‹

Orders integrate with payment gateways:

  • Stripe (recommended)
  • PayPal
  • Custom gateways

Important:

  • Never store credit card details directly
  • Use tokenization (Stripe.js, PayPal SDK)
  • OneEntry handles secure payment processing

Inventory Managementโ€‹

Orders automatically:

  • โœ… Deduct inventory on order creation
  • โœ… Restore inventory on cancellation
  • โœ… Track stock levels

Best practice: Check stock before creating order

Securityโ€‹

Orders contain sensitive data:

  • Customer personal information
  • Payment details
  • Shipping addresses

Always:

  • Use HTTPS for checkout pages
  • Validate data before creating orders
  • Implement proper authentication
  • Follow PCI DSS compliance for payments

๐Ÿ“Š Quick Reference Tableโ€‹

MethodDescription
createOrder()Create new order
getAllOrdersByMarker()Get all orders (paginated)
getOrderByMarker()Get one order storage object by marker.
getAllOrdersStorage()Getting all order storage objects.
getOrderByMarkerAndId()Getting one order by marker and id from the order storage object created by the user.
updateOrderByMarkerAndId()Update one order by marker and id from the order storage object created by the user.

โ“ Common Questions (FAQ)โ€‹

How do I create an order with multiple products?โ€‹

Pass an array of product objects in the order data. Each product should include id, quantity, and price. The total sum is calculated automatically based on product quantities and prices.


Can I update an order after it's been created?โ€‹

Yes, use updateOrderByMarkerAndId() to modify order details like status, shipping address, or order data. However, once payment is processed, be cautious when modifying order items or totals.


How do I track order status changes?โ€‹

Use the statusIdentifier field to track current order state. You can also set up webhooks or use the Events module to receive notifications when order status changes.


What's the difference between order storage and individual orders?โ€‹

Order storage is a container that groups related orders (like orders from a specific form or sales channel). Individual orders are the actual purchase transactions within that storage. Use markers to identify and organize different order storages.


How do I handle order cancellations and refunds?โ€‹

Update the order status to 'cancelled' using updateOrderByMarkerAndId(). For refunds, use the Payments module to process the refund transaction, then update the order status to 'refunded'.


Can I retrieve a customer's order history?โ€‹

Yes, use getAllOrdersByMarker() with appropriate filters to fetch all orders for a specific customer. You can filter by user ID, date range, or other criteria.


๐ŸŽ“ Best Practicesโ€‹

  • Validate cart before creating order - Check stock availability
  • Calculate totals on server - Never trust client-side calculations
  • Send order confirmations - Email customers after order placed
  • Track order status - Update status as order progresses
  • Handle payment failures - Retry logic, clear error messages
  • Implement order search - Let customers find their orders easily
  • Store order history - Keep records for customer service
  • Use pagination - Don't load all orders at once

More information about the module's user interface https://doc.oneentry.cloud/docs/category/orders


Definition of the Orders moduleโ€‹


const { Orders } = defineOneEntry(
"your-project-url", {
"token": "your-app-token"
}
);