Medusa v2 plugin providing optimized POS endpoints
Medusa v2 plugin that adds the product endpoints any POS (Point of Sale) app needs. Built by Nari Solutions.
Without these custom endpoints, a POS talking to Medusa's generic API has two problems: stock isn't checked automatically when adding items to a cart, and prices come back raw — not context-calculated. This plugin's endpoints return live inventory quantities per variant and context-calculated prices (), plus a option to choose exactly which product fields you fetch.
yarn add @narisolutions/medusa-plugin-pos
Add the plugin to your :
import PosPlugin from "@narisolutions/medusa-plugin-pos"export default defineConfig({plugins: [PosPlugin({defaultCurrencyCode: "usd", // optional — used when ?currency_code= is omittedrateLimit: { // optional — per-IP rate limitingwindowMs: 60_000, // 1 minute windowmax: 100, // max requests per window},}),],})
All endpoints require an admin bearer token ().
Returns all published products for a sales channel, with inventory quantities per variant.
| Query param | Type | Description |
|---|---|---|
| string | Include for each variant | |
| string | Comma-separated extra fields appended to the default field list |
The default field list covers core product/variant fields. Fields like are not included by default — opt in via .
Response: array of product objects.
Looks up a single product by barcode value, with inventory quantities.
The path parameter is matched first against the variant field, then falls back to the field. This means physical barcodes stored in work out of the box — is the fallback for stores that populate that field instead.
| Query param | Type | Description |
|---|---|---|
| string | Include for each variant | |
| string | Comma-separated extra fields appended to the default field list (e.g. ) |
Response: single product object. Returns if no variant matches either field.
Returns . Requires auth. Use for backend health checks from your POS.
Obtain a bearer token from the Medusa admin auth endpoint:
Use the returned token as on all requests.
const res = await fetch(`/pos/products/${salesChannelId}?currency_code=usd`,{ headers: { Authorization: `Bearer ${token}` } })const products = await res.json()
const res = await fetch(`/pos/product-by-barcode/${salesChannelId}/${ean}?currency_code=usd`,{ headers: { Authorization: `Bearer ${token}` } })const product = await res.json()
| Option | Type | Default | Description |
|---|---|---|---|
| Fallback currency code when is not passed | |||
| — | Rate limit window in milliseconds | ||
| — | Max requests per IP per window |
Apache-2.0