Sales Reports
Sales reporting plugin that totals revenue, units and orders by period, product and customer from Payload order collections.
Installation
pnpm add payload-sales-reports About
The plugin reads an orders collection (the one shipped by `@payloadcms/plugin-ecommerce` or any equivalent) and produces sales totals grouped by period, product and customer. It exposes the data as plain async functions and as three read-only `GET` endpoints under the Payload API route: `/sales-reports/summary`, `/sales-reports/by-product`, and `/sales-reports/by-customer`. It adds no collection, no field, and no hook, so the database schema is untouched and everything is computed by paging through orders at query time. Configuration is small. `timeZone` sets the IANA zone used to cut period boundaries. `isAdmin` gates every endpoint and defaults to checking `'admin'` in `req.user.roles`, but accepts a function so a differently shaped users collection can be used. `statuses` controls which order statuses count as a sale and defaults to `['processing', 'completed']`. `limit` caps the rows returned by `byProduct` and `byCustomer`, `pageSize` controls how many orders are read per query, and `maxOrders` bounds how many orders a single report will read before stopping and reporting `truncated: true`. Orders are read in pages; the whole order table is never held in memory. Amounts are returned as integers in minor units, matching how the ecommerce plugin writes them (`Math.round(value * 10 ** currency.decimals)`). The plugin never sums across currencies: every row carries its own `currency`, `totals` is a list with one entry per currency, and `currency=EUR` narrows a response. Per-product revenue is reported only when order lines carry an amount field, which a standard `createOrdersCollection` install does not set, so `byProduct` always returns `units` and `orders` and reports `revenueByProductAvailable: false` unless line amounts exist. The package ships no React component. An admin view is optional: pass `{ Component, path }` via `adminView` to register a view you write in your own project, where it stays next to the Payload version you run. The plugin only reads data; it performs no writes. Invalid option values fall back to defaults instead of being applied.
Package info
- Package name
payload-sales-reports- Latest version
1.0.1- Unpacked size
- 35 kB
- License
- MIT
- Weekly downloads
- 11
- Last publish
- Aug 21, 2026
More from Poseidonas
View profileBarcodes
Adds Code 128, EAN-13 and QR code generation to Payload product collections with a printable label page and optional admin print buttons.
AI Manager
Writes product titles, descriptions, attributes and translations into Payload fields via Claude, ChatGPT, Gemini or Kimi, and skips content it already generated.
EU VAT
Records EU VAT on Payload ecommerce orders: country rates, B2B reverse charge, VIES validation, and OSS reporting totals.
Stock Reservation
Validates variant stock and price before checkout and holds reserved inventory until payment settles, extending the official Payload ecommerce plugin.
Stock Alerts
Sends a shop one email when product or variant inventory crosses a low stock threshold, with backorder handling and a storefront-readable status field.
Shipping Rates
Adds shipping zones, rate calculation, and a quote endpoint to Payload ecommerce shops.
Similar plugins
More in CommerceStripe
Syncs Payload collections with Stripe resources and routes Stripe webhooks and API calls through Payload.
Tpay E-commerce Payment Adapter
Adds BLIK, bank transfer and card payments through Tpay to Payload's e-commerce plugin, with webhook verification and stock-aware order confirmation.
Google Merchant Center Ecommerce Integration
Sync products with Google Merchant Center from Payload CMS.