Orders¶
Orders are the core transaction record in Vectis. Every completed checkout produces an order that tracks line items, pricing, tax, shipping, and fulfillment status.
Checkout Flow¶
The checkout pipeline runs these steps in sequence:
graph LR
A[Cart] --> B[Promotions Evaluated]
B --> C[Shipping Calculated]
C --> D[Tax Calculated]
D --> E[Payment Processed]
E --> F[Order Created] - Cart finalized — all line items, quantities, and the shipping address are set.
- Promotions evaluated — discount rules and coupon codes are matched. Allocations are computed per line item.
- Shipping calculated — carrier strategies return rates for the selected method.
- Tax calculated — all registered tax strategies run; per-line tax lines are written.
- Payment processed — the payment strategy authorizes or charges the payment method based on the configured capture mode.
- Order created — the cart converts to an order with immutable line-level snapshots of price, tax, and discount.
Order State Machine¶
Orders follow a configurable state machine. The default EmpireOrderProcess defines these states:
| State | Meaning |
|---|---|
Created | Order record exists, initial state |
PendingApproval | B2B order awaiting approval from an authorized approver |
AwaitingPayment | Offline/terms payment pending |
AwaitingFulfillment | Payment captured or authorized, ready to pick/pack |
ManuallyVerifyPayment | Staff must manually confirm payment |
HeldForReview | Payment flagged by gateway fraud filters (see Payments → Fraud) |
PartiallyFulfilled | Some shipments dispatched |
Fulfilled | All shipments dispatched |
Cancelled | Order cancelled — triggers automatic void/refund |
Refunded | Refund processed for captured payments |
Custom states
The state machine is strategy-defined. Deployments can add states like Backordered or PartiallyShipped without modifying core code.
Transitions¶
Transitions are guarded — a Fulfilled order cannot jump back to Created. Side-effects (void/refund, emails, Redpanda events, ERP sync) fire on each transition.
Key automatic behaviors:
- Cancel → auto void/refund: Transitioning any order to
Cancelledautomatically voids authorized transactions or refunds captured ones. - Refund → auto refund: Transitioning from
FulfilledtoRefundedautomatically refunds all captured transactions. - Fraud release → AwaitingFulfillment: Releasing a fraud hold transitions from
HeldForReviewtoAwaitingFulfillment.
Order Totals¶
Every order stores five monetary totals:
| Field | Description |
|---|---|
subtotal | Sum of (unit_price × quantity) for all lines |
discount_total | Sum of all promotion allocations |
tax_total | Sum of all tax lines across all order lines |
shipping_total | Shipping cost after any free-shipping promotions |
grand_total | subtotal - discount_total + tax_total + shipping_total |
Order Modification¶
Orders in an editable state with payment_status="authorized" can be modified:
- Add lines — specify a variant ID and quantity.
- Remove lines — remove existing line items.
- Update quantities — change the quantity on existing lines.
When an order is modified:
- Totals are recalculated (subtotal, grand total, base amounts).
- The existing authorization is voided.
- A new authorization is placed for the updated grand total.
- An
order.modifiedevent is recorded.
This is available to admins and B2B buyers via the modifyOrder mutation. Only authorized (not captured) orders can be modified.
Warning
Once payment is captured, the order cannot be modified. Refund and re-create instead.
Admin Order Creation¶
Staff can create orders directly from the admin panel:
- Navigate to Orders → Create Order.
- Select an account and channel.
- Add line items by variant ID.
- Set addresses, shipping, and notes.
- Choose a saved card or payment method with capture mode.
See Payments → Admin Order Creation for details.
B2B Features¶
Vectis orders support several B2B-specific capabilities:
- PO numbers — buyers attach a purchase order reference at checkout. The PO number appears on invoices and in admin search.
- Approval workflows — orders from accounts with approval rules enter a
PendingApprovalstate. Authorized approvers confirm or reject via the admin panel or API. - Payment terms — accounts configured with net-30, net-60, or custom terms create orders without immediate payment. The order records the terms and due date.
- Location-scoped cards — saved payment methods can be scoped per location for B2B accounts with multiple sites.
Multi-Currency¶
Orders store dual amounts on every monetary field:
- Transacted amount — the currency the buyer paid in (e.g.,
100.00 MXN). - Base amount — the equivalent in your base currency (e.g.,
5.88 USD).
The exchange rate is locked at checkout time and stored on the order. Subsequent rate fluctuations do not affect existing orders.
Note
The base currency is set per channel. All reporting and accounting queries can use base amounts for consistent aggregation.
Fraud Handling¶
Orders flagged by gateway fraud filters (Authorize.net FDS) enter the HeldForReview state. The admin can:
- Release the hold — approves the transaction and moves the order to
AwaitingFulfillment. - Cancel the order — voids the held transaction.
See Payments → Fraud Filter Handling for the full workflow.
Admin Panel¶
From Orders in the admin panel you can:
- Search and filter by status, date range, account, PO number, or order ID.
- View order detail — line items with per-line tax breakdown, discount allocations, and fulfillment status.
- Transition status — move an order to its next valid state. Invalid transitions are blocked by the state machine.
- View payment transactions — authorizations, captures, voids, refunds with gateway details. Capture authorized transactions, void, or refund directly from the transaction panel.
- Release fraud holds — approve transactions flagged by gateway fraud filters.
- Modify orders — add/remove/update line items on authorized orders with automatic reauthorization.
- Create orders — build orders from scratch for B2B customers with saved card charging.
- Add internal notes — staff-only notes attached to the order timeline.
Warning
Transitioning an order to Cancelled triggers automatic void or refund of all open payment transactions. This action cannot be undone.