Raw
1 ---
2 products:
3 - order
4 - fulfillment
5 - inventory
6 - sales channel
7 ---
8
9 import { AcademicCapSolid, BoltSolid } from "@medusajs/icons"
10 import { LearningPath } from "docs-ui"
11
12 export const metadata = {
13 title: `Order Management System (OMS) Recipe`,
14 }
15
16 # {metadata.title}
17
18 This recipe provides an overview of Medusa's features and how to use it as an Order Management System (OMS).
19
20 ## Overview
21
22 Building or integrating an OMS brings certain challenges: accepting orders from different sales channels, tracking inventory across the sales channels, integrating third-party fulfillment and payment providers with the OMS, and more.
23
24 Medusa's Commerce Modules and [Framework](!docs!/learn/fundamentals/framework) for customizations allows you to integrate it within a larger ecosystem. The Commerce Modules provide features to allow businesses to accept orders from any sales channel, benefit from multi-warehouse inventory features, and integrate third-party services for fulfillment, payment, and more.
25
26 <Note title="Related use-case">
27
28 [How Siam Makro used Medusa an OMS](https://medusajs.com/blog/makro-pro/).
29
30 </Note>
31
32 ---
33
34 ## Source Orders into Medusa
35
36 Sales channels in your commerce ecosystem must route their orders into the OMS.
37
38 ![Routing orders into Medusa OMS](https://res.cloudinary.com/dza7lstvk/image/upload/v1709032160/Medusa%20Book/oms-orders_zf5ta9.jpg)
39
40 Medusa's [Store REST APIs](!api!/store) let you integrate a checkout experience in any storefront. Alternatively, you can use Medusa's [Draft Order APIs](!api!/admin/draft-orders) to place an order without direct involvement from the customer, such as when placing an order through a POS.
41
42 In addition, you can customize the Medusa application to accept orders through a third-party checkout system. This gives you more flexibility over adding orders to Medusa.
43
44 For example, you can support importing orders into Medusa through a custom API Route that allows batch-inserting orders. Another example is creating a scheduled job that runs at a specified interval and imports orders from a third-party service.
45
46 <CardList items={[
47 {
48 href: "!api!/store/carts",
49 title: "Store REST APIs",
50 text: "Learn how to use the Store REST APIs to create an order.",
51 icon: AcademicCapSolid,
52 },
53 {
54 href: "!docs!/learn/fundamentals/api-routes",
55 title: "Create API Route",
56 text: "Learn how to create a custom API Route.",
57 icon: AcademicCapSolid,
58 },
59 ]} />
60
61 <Card
62 href="!docs!/learn/fundamentals/scheduled-jobs"
63 title="Create Scheduled Jobs"
64 text="Learn how to create a scheduled job."
65 icon={AcademicCapSolid}
66 className="mt-1"
67 />
68
69 ---
70
71 ## Route Orders to Third-party Fulfillment Services
72
73 To integrate third-party fulfillment providers with the Medusa application, you can create a fulfillment module provider.
74
75 Medusa uses the Fulfillment Module whenever a fulfillment action is performed, such as when a fulfillment is created for items in an order. The methods of the module's main service use the associated fulfillment module provider to handle the desired fulfillment actions.
76
77 ![Fulfilling orders with Medusa OMS](https://res.cloudinary.com/dza7lstvk/image/upload/v1709032184/Medusa%20Book/oms-fulfillment_qfrpdd.jpg)
78
79 In addition, you can create a subscriber that listens to fulfillment-related events, such as the `order.fulfillment_created` event, to perform actions with the third-party fulfillment provider.
80
81 <CardList itemsPerRow={2} items={[
82 {
83 href: "/references/fulfillment/provider",
84 title: "Create a Fulfillment Module Provider",
85 text: "Learn how to create a fulfillment provider in Medusa.",
86 icon: AcademicCapSolid,
87 },
88 {
89 href: "/references/order/events",
90 title: "Order Events",
91 text: "Learn about the events emitted related to the Order Module",
92 icon: AcademicCapSolid,
93 },
94 ]} />
95
96 <Card
97 href="!docs!/learn/fundamentals/events-and-subscribers"
98 title="Create a Subscriber"
99 text="Learn about create a subscriber"
100 icon={AcademicCapSolid}
101 className="mt-1"
102 />
103
104 ---
105
106 ## Process Payment with Third-Party Providers
107
108 To integrate third-party payment providers with the Medusa application, you can create a payment module provider. Customers can pay for their orders using this providers, and admins can process order payments using it.
109
110 In addition, you can create a subscriber that listen to payment-related events, such as the `payment.captured` event, to perform actions in the third-party payment provider.
111
112 <CardList itemsPerRow={2} items={[
113 {
114 href: "/references/payment/provider",
115 title: "Create a Payment Module Provider",
116 text: "Learn how to create a payment module provider.",
117 icon: AcademicCapSolid,
118 },
119 {
120 href: "/references/payment/events",
121 title: "Payment Events",
122 text: "Learn about the events emitted related to the Payment Module",
123 icon: AcademicCapSolid,
124 },
125 ]} />
126
127 <Card
128 href="!docs!/learn/fundamentals/events-and-subscribers"
129 title="Create a Subscriber"
130 text="Learn about create a subscriber"
131 icon={AcademicCapSolid}
132 className="mt-1"
133 />
134
135 ---
136
137 ## Track Inventory Across Sales Channels
138
139 Medusa's Inventory, Stock Location, and Sales Channel modules allow merchants to track inventory levels tied to sales channels across stock locations.
140
141 When an order is placed, the item's quantity is reserved from the stock location associated with the order's sales channel.
142
143 Once the item is fulfilled, the reserved quantity is deducted from the item's inventory quantity.
144
145 <CardList items={[
146 {
147 href: "/commerce-modules/inventory",
148 title: "Inventory Module",
149 text: "Learn about the Inventory Module's concepts and features.",
150 icon: AcademicCapSolid,
151 },
152 {
153 href: "/commerce-modules/stock-location",
154 title: "Stock Location Module",
155 text: "Learn about the Stock Location Module's concepts and features.",
156 icon: AcademicCapSolid,
157 }
158 ]} />
159
160 <Card
161 href="/commerce-modules/sales-channel"
162 title="Sales Channel Module"
163 text="Learn about the Sales Channel Module's concepts and features."
164 icon={AcademicCapSolid}
165 className="mt-1"
166 />
167
168 ---
169
170 ## Handle Returns, Exchanges, and Changes
171
172 Customers can return or exchange items in an order. A merchant can also edit an order to add, update, or delete items.
173
174 When changes are made to an order by any of the mentioned actions, the changes are reflected on the order's totals and associated inventory. The integrated fulfillment and payment module providers are used if fulfillment or payment actions are required, such as fulfilling exchanged items.
175
176 Medusa also emits events related to these actions, such as `order.return_requested`. So, you can build a workflow that performs actions with the third-party fulfillment and payment providers, then execute it in a subscriber that's triggered whenever the event is emitted.
177
178 <CardList items={[
179 {
180 href: "/commerce-modules/order/order-change",
181 title: "Order Changes",
182 text: "Learn about how to use order changes.",
183 icon: AcademicCapSolid,
184 },
185 {
186 href: "/references/order/events",
187 title: "Order Events",
188 text: "Learn about the events emitted related to the Order Module",
189 icon: AcademicCapSolid,
190 },
191 {
192 href: "!docs!/learn/fundamentals/workflows",
193 title: "Create a Workflow",
194 text: "Learn how to create a workflow.",
195 icon: AcademicCapSolid,
196 },
197 {
198 href: "!docs!/learn/fundamentals/events-and-subscribers",
199 title: "Create a Subscriber",
200 text: "Learn about create a subscriber",
201 icon: AcademicCapSolid,
202 }
203 ]} />