Order Return Request Module
In this section of the documentation, you will find resources to learn more about the Order Return Request Module and how to use it in your application. Mercur has order return management features available out-of-the-box through the Order Return Request Module. A module is a standalone package that provides features for a single domain. Each of Mercur’s marketplace features are placed in custom modules, such as this Order Return Request Module. Learn more about why modules are isolated in this documentation.Order Return Request Features
- Customer Return Requests: Allow customers to request returns for purchased items with reasons and notes.
- Multi-Tier Review System: Support both vendor review and admin escalation for dispute resolution.
- Line Item Tracking: Track which specific items and quantities are being returned.
- Status Workflow: Manage return requests through multiple statuses (pending, refunded, withdrawn, escalated, canceled).
- Reviewer Notes: Store notes from both vendors and admins explaining their decisions.
- Shipping Integration: Associate return requests with shipping options for return logistics.
How to Use the Order Return Request Module
In your Medusa application, you build flows around Commerce Modules. A flow is built as a Workflow, which is a special function composed of a series of steps that guarantees data consistency and reliable roll-back mechanism. You can build custom workflows and steps. Mercur provides pre-built workflows for return request operations in the@mercurjs/requests package.
For example, the createOrderReturnRequestWorkflow:
src/workflows/order-return-request/create-return-request.ts
API Route
src/api/store/return-request/route.ts
Concepts
In this document, you’ll learn about the main concepts related to order return requests in Mercur.Order Return Request
An order return request represents a customer’s request to return items from an order. It is represented by the OrderReturnRequest data model. An order return request holds information about:- The customer who submitted the request
- Customer’s note explaining the return reason
- Shipping option for return logistics
- Vendor reviewer information (ID, note, review date)
- Admin reviewer information (ID, note, review date)
- Current status in the review workflow
- Associated line items being returned
Return Request Status Workflow
Return requests follow a multi-tier approval workflow with five possible statuses:pending
Initial state when customer creates the return request.- Awaiting vendor review
- Customer has submitted their reason
- No action taken yet
refunded
Approved by vendor - the return is accepted.- Vendor agrees with the return reason
- Return and refund process proceeds
- Customer receives refund
- Items are returned to seller
withdrawn
Rejected by vendor - the return is denied.- Vendor determines return doesn’t meet criteria
- Vendor provides explanation in
vendor_reviewer_note - No refund issued
- Customer keeps the items
escalated
Disputed by vendor - vendor disagrees with return reason.- Vendor believes return is unfair or against policy
- Request is escalated to marketplace admin for final decision
- Admin reviews both customer and vendor perspectives
- Admin makes final decision (refunded or canceled)
canceled
Rejected by admin - admin sides with vendor on escalated request.- Admin reviewed escalated request
- Admin determined vendor was correct to deny
- Admin provides explanation in
admin_reviewer_note - No refund issued
Return Request Line Item
A return request line item specifies which products and quantities are being returned. It is represented by the OrderReturnRequestLineItem data model. Each line item includes:- Original order line item ID
- Quantity to be returned (can be partial)
- Return reason ID (optional)
Multi-Tier Review System
The return request system implements a two-tier review process:Tier 1: Vendor Review
Reviewer: Seller memberActions: Refunded, Withdrawn, Escalated
Fields:
vendor_reviewer_id, vendor_reviewer_note, vendor_review_date
Vendors handle the first level of review, deciding whether to:
- Accept the return (refunded)
- Deny the return (withdrawn)
- Dispute the return (escalated)
Tier 2: Admin Review (Escalations Only)
Reviewer: Marketplace adminActions: Refunded, Canceled
Fields:
admin_reviewer_id, admin_reviewer_note, admin_review_date
Admins only review escalated requests, providing final arbitration when vendors and customers disagree.
This system balances seller autonomy with marketplace oversight.
Return Request Validation
ThevalidateOrderReturnRequestStep ensures return requests meet requirements:
- Order exists and belongs to the customer
- Line items exist in the order
- Quantities don’t exceed ordered amounts
- Order is in a returnable state
- Return window hasn’t expired (if configured)
Workflow Integration
Return requests integrate with other marketplace workflows: On Creation:- Links created to Seller and Order
- Workflow hook emitted for extensibility
- Notifications can be triggered
- Return and refund workflows triggered (if refunded)
- Inventory updated (if items returned to stock)
- Payout adjustments made (if already paid out)