Downloads
Sells digital products from a Payload store using signed, expiring download links that stop working when an order is refunded.
Installation
pnpm add payload-downloads About
Sells digital products from a Payload ecommerce store. A product or variant carries one or more files, a paid order earns access to them, and the customer receives a signed link that expires, counts its uses, and stops working the moment the order is refunded. The plugin hooks into the orders collection `afterChange` hook and grants or revokes access based on the order status. It adds a `download-grants` collection that records one grant per order and file, plus a `downloadable` checkbox and a `downloadFiles` upload field on the products (and variants) collections. Two endpoints are added: `GET /api/downloads` for a signed in customer to read their own downloads, and `GET /api/downloads/file` to stream the bytes. It works with `@payloadcms/plugin-ecommerce` and with any collection that holds orders. Signed links use `node:crypto` HMAC-SHA256 with no runtime dependencies. The key is derived from the Payload secret rather than being the secret itself, and grant, order, file and expiry are all inside the signed message so a signature cannot be moved to another file, order, grant or a later expiry. Verification uses `timingSafeEqual`. The file is streamed by the plugin, so no storage path, URL or bucket key ever reaches the client. Before a byte is written the plugin reloads the grant and refuses it if it is revoked, expired or at its limit, which means a refund stops links that were already handed out. Options control the download limit, expiry days, link TTL, which statuses grant or revoke, customer and collection slugs, and whether variants are enabled. Local storage works out of the box. Payload has no stable public API for reading the bytes behind an upload document when a cloud adapter owns them, so a storage adapter needs a `fileResolver` callback. There are no admin components, which keeps the plugin stable across minor Payload releases. Server side helpers like `downloadLinksForOrder`, `grantAccess` and `revokeAccess` are exported for use in order emails or custom flows.
Package info
- Package name
payload-downloads- Latest version
1.0.0- Unpacked size
- 47 kB
- License
- MIT
- Last publish
- Aug 20, 2026
More from Poseidonas
View profileSales Reports
Sales reporting plugin that totals revenue, units and orders by period, product and customer from Payload order collections.
Ecommerce Product Reviews
Adds product reviews and aggregate ratings to a Payload ecommerce shop, with verified-purchase detection and moderation before reviews go public.
Refunds
Adds full and partial refund records to Payload ecommerce orders, with per-line caps, optional restock, and an append-only audit trail.
Order Emails
Sends a transactional email when a Payload order is created and on each status change, routed through your configured email adapter.
Invoices
Gapless sequential invoices and credit notes for Payload ecommerce orders, with frozen snapshots and dependency-free PDF output.
Fulfillment
Adds fulfillment states, transition history, internal notes and tracking fields to Payload ecommerce orders.