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.1- Unpacked size
- 47 kB
- License
- MIT
- Weekly downloads
- 13
- 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.