Order vs. invoice: a distinction often missed
The purchase order (PO) is the internal ID your team uses to identify an operation: what the customer bought, what you'll deliver. The invoice is the fiscal document issued when billing. One PO can spawn several invoices (partial deliveries) or none (if cancelled). That's why independent numbering is best — and why serious CRMs split the two flows.
Recommended format by industry
| Context | Example | Advantage | Risk |
|---|---|---|---|
| Ecommerce | ORD-20260805-0042 | Visible date | Exposes daily volume |
| B2B | PO-2026-01042 | Easy to dictate | Sequence must be stored |
| Multi-country | ORD-US-2026-1042 | Shows origin | Longer format |
| Public reference | ORD-2026-583104 | Hides volume | Uniqueness must be checked |
- Ecommerce. ORD-YYYYMMDD-#### is most useful: tells you at a glance when the order was placed without DB lookups.
- B2B / corporate. PO-YYYY-#### with a 5-6 digit sequence. More anonymous, better for long-running processes.
- SaaS / subscriptions. SUB-{CustomerID}-#### ties the order to the customer right in the ID.
- Logistics / dropshipping. Often add origin prefix: ORD-US-2026-####, ORD-UK-2026-####.
Why include date in the ID
Embedding the date offers two operational wins: chronological sorting without an extra column, and fast debugging when a customer calls about a purchase from "two months ago". If you handle 100+ orders per day, consider dropping the date and ordering by DB — the ID gets unwieldy.
Sequential vs. random
Sequential is preferable for internal management and audits. Random is used when you don't want to expose how many orders you have (e.g. on a new store: customer sees "ORD-2026-0003" and knows you're brand new). A common shortcut is to start the sequence high (10001 instead of 1) — keeps order, hides volume.
Traceability: what to store with the ID
- Creation timestamp. Even if the date is in the ID, store the exact time.
- Status. Pending, paid, picking, shipped, delivered, returned, cancelled.
- Customer and payment method. For reconciliation.
- Status change logs. Who moved it and when. This saves you in disputes.
Common mistakes
- Reusing IDs. If an order is cancelled, do NOT reassign that ID — historical confusion guaranteed.
- Changing format mid-year. Keep it stable; switch only at fiscal-year transitions.
- Ultra-long IDs. Over 20 characters becomes painful on phone and chat.
- Lookalike characters. Avoid O vs 0, I vs 1 in confusing positions.
What this generator does —and does not do
Genfy creates copy-ready references but is not a database: it does not remember the
last sequence, check collisions against your store, or reserve numbers across users.
In production, persist the counter in an atomic transaction or enforce a
UNIQUE constraint. For a globally unique technical ID, use the
UUID generator; for inventory codes, use the
SKU generator.