Module Links
Reorder defines six module links that connect subscription records to Medusa core data. These links are established using Medusa’sdefineLink API and resolve through the standard query interface.
| Reorder model | Medusa module | Cardinality | Description |
|---|---|---|---|
Subscription | Customer | many-to-one | One customer can own many subscriptions |
Subscription | Cart | one-to-one | The cart from the subscription checkout |
Subscription | Order | one-to-many | Original checkout order and all subsequent renewal orders |
RenewalCycle | Order | one-to-one | The Medusa order generated for each renewal cycle |
query.graph() from any workflow, API route, or subscriber — no Reorder-specific query layer is needed.
Product and variant data is stored directly on the
Subscription record as product_id, variant_id, and a product_snapshot field. Link definitions for Product and ProductVariant exist in the Reorder codebase but those link records are not populated during normal operation — use the snapshot fields to read product context.Checkout Flow
When a customer subscribes through the storefront, Reorder wraps Medusa’s nativecompleteCartWorkflow. The subscription record is created and linked to the resulting order in the same transaction. After checkout completes:
- A
Subscriptionrecord is created in Reorder’s module. - The subscription is linked to the
Orderproduced bycompleteCartWorkflow. - The subscription is linked to the
CustomerandCartvia module links. - Product and variant data from the cart line items is stored as a snapshot on the subscription record.
- The first
RenewalCycleis scheduled based on the plan’s billing frequency.
Payment Module Integration
Reorder uses Medusa’s payment module for all money movement. It does not implement its own payment provider or store payment credentials. Renewals — when a renewal cycle executes, Reorder creates a new order usingcreateOrderWorkflow, then calls createOrUpdateOrderPaymentCollectionWorkflow and createPaymentSessionsWorkflow to collect payment. Authorization and capture are handled via the payment module service directly.
Dunning — when a renewal payment fails, Reorder opens a DunningCase and schedules retry attempts. Each attempt re-uses createOrUpdateOrderPaymentCollectionWorkflow and createPaymentSessionsWorkflow against the same renewal order. Attempt records are stored on the DunningCase.
Because payment processing goes through Medusa’s standard workflows, any payment provider that works with your Medusa store automatically works with Reorder subscriptions and renewals.