• Сообщество
  • Блог
Документация
Плагины и интеграцииВсе расширения для Medusa от сообществаСтартерыЗапускайте проекты быстрее с готовыми решениями
ЭкспертыПодберите специалиста для разработки и развития вашего проекта на MedusaКейсыПосмотрите примеры Medusa в продакшене и успешные внедрения
Меч Moscow
Комплексная e-commerce платформа на Medusa для московского fashion-бренда

Меч Moscow · Fashion

Gorgo снижает затраты на адаптацию Medusa к локальным рынкам.

Мы разрабатываем плагины интеграции, осуществляем поддержку и развиваем сообщество разработчиков на Medusa в Telegram.

  • Ресурсы Medusa
  • Плагины и интеграции
  • Стартеры
  • Эксперты
  • Кейсы
  • Medusa Чат в Telegram
  • Medusa Новости в Telegram
  • Документация Gorgo
  • Связаться с нами
  • TelegramGitHub
Плагины
D

Digital products

Digital products, licensing, entitlement, activation, and secure download management for Medusa v2.

npm install medusa-plugin-digital-products
Категория
Другое
Создано
Yousofabouhalawa
Версия
0.2.2
Последнее обновление
4 дня назад
Ежемесячные загрузки
Загрузка данных
Звезды на Github
0
npmNPMGitHubGithub

Medusa Digital Products

An installable Medusa v2 plugin for digital products, software licensing, customer entitlements, device activations, and protected file delivery.

The plugin fills the domain gap between selling a non-shippable product and operating a production licensing system. It is built as a native Medusa plugin: module data models, rollback-capable workflows, authenticated Admin and Store APIs, a product-variant module link, subscribers, a scheduled expiry job, migrations, and an Admin extension.

Features

  • Digital products linked one-to-one with Medusa product variants.
  • Versioned assets backed by Medusa's configured File Module provider.
  • Perpetual, time-limited, subscription, and trial license policies.
  • A native Medusa Fulfillment Module provider for zero-cost digital delivery.
  • Automatic, idempotent fulfillment on : entitlements, quantity-aware license keys, protected download grants, email delivery, and delivered status.
  • Manual grants for support, promotions, migrations, and B2B use cases.
  • Automatic revocation when an order is canceled and explicit admin revocation for refunds or chargebacks.
  • Quantity-aware, one-time license-key issuance.
  • HMAC-hashed license keys and download tokens; plaintext credentials are never persisted.
  • Device activation limits, validation, reactivation, and deactivation.
  • Short-lived download grants with policy-level, per-asset download limits.
  • Immutable audit events for sensitive mutations.
  • Hourly expiry of entitlements, licenses, and download grants.
  • A read-only Admin overview at .

Compatibility

  • Medusa
  • Node.js
  • PostgreSQL (as required by Medusa)

Installation

npm install medusa-plugin-digital-products

Register the plugin in :

1import { defineConfig, loadEnv } from "@medusajs/framework/utils"
2
3loadEnv(process.env.NODE_ENV || "development", process.cwd())
4
5module.exports = defineConfig({
6 // your existing projectConfig
7 modules: [
8 {
9 resolve: "@medusajs/medusa/fulfillment",
10 options: {
11 providers: [
12 {
13 resolve: "medusa-plugin-digital-products/providers/digital-fulfillment",
14 id: "digital-products",
15 },
16 ],
17 },
18 },
19 ],
20 plugins: [
21 {
22 resolve: "medusa-plugin-digital-products",
23 options: {},
24 },
25 ],
26})

Configure a secret of at least 32 characters. Treat this as production key material and keep it stable; changing it invalidates credential lookups.

1DIGITAL_PRODUCTS_SECRET=replace-with-a-random-secret-at-least-32-characters
2MEDUSA_BACKEND_URL=https://api.example.com
3DIGITAL_PRODUCTS_ACCOUNT_URL=https://shop.example.com/account/digital-products
4# Optional; defaults to seven days and is capped at thirty days.
5DIGITAL_PRODUCTS_DELIVERY_TOKEN_TTL_SECONDS=604800

Run the plugin migrations from the host application:

npx medusa db:migrate

Use an S3-compatible File Module provider in production. Medusa's local provider is intended for development.

Configure an email-capable Notification Module provider that supports direct . Raw license keys and download tokens are only placed in the transient provider payload, never in the plugin database, fulfillment metadata, audit log, or notification record.

Fulfillment setup

After registering the provider, add to the stock location that sells digital products. Create a fixed-price shipping option from its service, price it at zero, and make it available in the relevant service zone. Digital carts must select that option during checkout. This is especially important for mixed carts: the plugin explicitly selects the digital shipping option for the digital line items and leaves physical items to their own provider.

Configure linked variants as non-physical () and do not manage inventory unless you intentionally impose digital stock limits. The order must still contain the zero-priced digital shipping method so Medusa can associate its fulfillment with this provider.

Domain flow

  1. Create a license policy.
  2. Create a digital product linked to an existing product variant.
  3. Upload the binary with Medusa's File API, then attach its as a digital asset.
  4. Publish the digital product by setting its status to .
  5. When the linked variant is purchased, the subscriber runs one rollback-capable delivery workflow.
  6. The workflow grants entitlements, issues one key per purchased quantity, creates protected asset links, creates the Medusa fulfillment through this provider, marks it delivered, and emails the buyer.
  7. Authenticated customers can later issue any remaining keys or fresh short-lived download grants from their account.
  8. License clients activate and validate keys using a stable device identifier.

For non-shippable catalog configuration, set the Medusa product/variant inventory and shipping requirements according to the official selling-products guide.

Admin API

All Admin endpoints use Medusa's standard Admin authentication.

MethodRoutePurpose
, List or create digital products
, , Retrieve, update, or archive a digital product
Attach a File Module asset
, List or create policies
, List or manually grant entitlements
Revoke an entitlement
Issue a license key once
Safely retry or manually trigger digital fulfillment

Store API

Use the Medusa JS SDK so customer authentication and publishable API keys are included automatically.

MethodRoutePurpose
List the authenticated customer's entitlements
Issue a license key owned by the customer
Create a short-lived download token
Consume a token and return the provider URL to an SDK client
Activate a license for a device
Validate a license/device pair
Release a device activation

Example SDK request:

1const result = await sdk.client.fetch(
2 `/store/customers/me/digital-products/${entitlementId}/downloads`,
3 {
4 method: "POST",
5 body: { asset_id: assetId },
6 }
7)

Emailed download links use . This browser-facing route is outside Medusa's publishable-key-protected namespace because normal link navigation cannot attach SDK headers. The high-entropy, expiring, usage-limited token is the authorization credential; successful redemption redirects to the File Module provider URL.

Security model

  • License keys and download tokens are returned only at issuance and stored as HMAC-SHA-256 hashes.
  • Customer ownership checks run inside workflows, not route handlers.
  • Download grants expire after five minutes by default, are capped at one hour, and are one-use.
  • File URLs come from the configured Medusa File Module provider only after grant consumption.
  • Device identifiers are HMAC-hashed before persistence.
  • API responses use for redeemed links.
  • Never put raw license keys or download tokens in logs, metadata, analytics, or audit events.

Guest buyers receive their license keys and protected download links at the order email. Their entitlement remains email-bound until the host application associates or claims it for a customer account.

If delivery fails—for example because the email provider is unavailable—the workflow compensates the fulfillment, licenses, grants, and newly created entitlements. Fix the provider configuration and retry with . Completed deliveries are detected from fulfillment metadata and are not duplicated.

Local development

1npm install
2npm run build
3npm run lint
4npm test
5# Requires PostgreSQL and the DB_HOST, DB_PORT, DB_USERNAME, and DB_PASSWORD variables.
6npm run test:integration:modules
7npm run test:package
8# Requires Docker; installs the packed plugin into an isolated Medusa host.
9npm run test:acceptance

Publish to Medusa's local plugin registry:

npx medusa plugin:publish

Then add it to a Medusa application with , register it in , run , and start the host with .

Publishing and Medusa listing

Build and inspect the package before publishing:

1npm run release:check
2npm run test:integration:modules
3npm pack --dry-run

Releases are published through the GitHub release workflow with npm provenance. The Git tag must exactly match . See RELEASING.md for first-release and trusted-publishing setup.

This plugin targets the Other category in Medusa's npm-curated Integrations Directory. The live category includes reusable commerce-feature plugins as well as third-party services, so the package uses the current and discovery metadata. See the listing strategy for the evidence, sync checklist, and escalation path. Directory inclusion remains Medusa's decision.

Support and security

Use GitHub issues for reproducible bugs and feature requests. Read SUPPORT.md before requesting help and report vulnerabilities privately as described in SECURITY.md.

License

MIT

Еще в этой категории

Посмотреть все
Другое
Gati logo

Gati

От Devx Commerce

Синхронизируйте Medusa с Gati ERP

Загрузка данных
npm
Другое
Product Reviews logo

Product Reviews

От Lambda Curry

Добавляйте рейтинги, отзывы и модерацию товаров

Загрузка данных
GitHubnpm
Другое
Variant Images logo

Variant Images

От Betanoir

Организуйте и загружайте варианты изображений в Medusa

Загрузка данных
GitHubnpm