Base.com (formerly BaseLinker) integration for MedusaJS v2 - catalog and stock sync, order export, status and tracking sync back
Two-way integration between Medusa v2 and Base.com (formerly BaseLinker).
Base owns the catalog and the warehouse; Medusa is the storefront. Products, prices and stock flow one way, orders flow the other, and shipment status comes back — so a customer sees a tracking number rather than an order stuck at "not fulfilled" forever.
| Data | Direction | Trigger |
|---|---|---|
| Products, variants, options, prices, images | Base → Medusa | scheduled job, or on demand |
| Stock levels | Base → Medusa | scheduled job (more frequent) |
| Orders | Medusa → Base | |
| Order status, tracking number | Base → Medusa | scheduled job |
The catalog is never pushed from Medusa to Base, which removes write conflicts entirely.
Add it to :
Then create the plugin's tables:
npx medusa db:migrateGet the API key from the Base.com panel under My account → API.
Only is required. Everything else has a default, and the ones that fall back log a warning naming what they picked.
| Option | Type | Default | Description |
|---|---|---|---|
| — | Required. API key from the Base.com panel. | ||
| account default | Which Base inventory to sync. | ||
| first channel | Sales channel imported products are linked to. Set it on a store with more than one. | ||
| first profile | Shipping profile assigned to imported products. | ||
| first status | Status given to orders exported to Base. | ||
| — | Order source shown in Base for orders from Medusa. | ||
| Base statuses meaning "shipped". Usually unnecessary — an order that acquires a tracking number is treated as shipped anyway. | |||
| What happens to a product that disappears from Base. | |||
| Largest share of products one sync may withdraw before refusing to act. | |||
| How far back the order status sync looks. | |||
| Payment provider ids that mean cash on delivery. | |||
| Friendly payment names per provider id. | |||
| Where to find the pickup point id in a shipping method's data. | |||
| Base's own limit. Lower it to leave room for other clients. |
A product missing from Base is inferred from a paginated listing, and a timed out page, a changed or a broken pagination loop all look exactly like a mass deletion. A draft product is gone from the storefront for every practical purpose — the Store API filters on published status and the cart rejects variants of unpublished products — but it keeps its handle, its history and its mapping, so a false alarm costs one sync instead of a full reimport.
guards both strategies, and a response containing no products at all is refused outright whatever the ratio allows.
Job schedules are read at load time, before plugin options exist, so they come from environment variables:
| Variable | Default | Runs |
|---|---|---|
| Full catalog import | ||
| Stock levels only | ||
| Order status and tracking |
Set any of them to to disable that job.
Stock runs far more often than the catalog on purpose: it is the figure that goes stale fastest, it is the one that costs a refund when it does, and one request covers the whole inventory.
All admin routes, all safe to call repeatedly.
| Route | Effect |
|---|---|
| Full catalog import, including stock | |
| Stock levels only | |
| Pull order status and tracking from Base | |
| Retry the export of one order |
Base has no concept of an option axis. A variant there is a separate product carrying a , identified by a free-text name.
Where every variant of a product declares the same features — the key/value map Base keeps in a product's text fields — those keys become real Medusa options, so a storefront gets separate Colour and Size selectors. Where the features are missing, inconsistent between variants, or would put two variants on the same combination, the import falls back to a single generated option whose values are the variant names. An honest one-dimensional list beats a broken two-dimensional one.
Features are only visible when a variant is fetched as a product of its own, so the catalog sync makes a second batched pass for them.
Products Base holds without any variants get a single default variant rather than being skipped.
Base has no idempotency key: calling twice creates two orders, and the API cannot delete either. The mapping row is therefore written before the call, and an order that already carries a Base id is skipped, so a retry — from a redelivered event, a restarted worker or an operator — is safe.
Failures are recorded on the mapping rather than thrown. A missing variant mapping or a rejected payload will not fix itself on the next attempt, and an exception would only bury it in a subscriber stack trace. Check :
Fix the cause, then .
An order with any unmapped line is not sent at all: a partial order would understate what the warehouse has to pack.
The shipping method the customer chose is sent as its name and price. Base is not asked which courier that is: mapping a delivery method to one of its 473 couriers is what Base's own automatic actions are for, and that rule belongs where the merchant can edit it rather than in a plugin release.
What the plugin does pass is the pickup point, when the checkout produced one. Base reads the locker or parcel shop from the order's — the courier's own parcel form has no field for it — so without this an operator has to paste the point id in by hand for every parcel, and no automatic action can create the shipment.
Where that id sits depends on whichever plugin handled the checkout, and carriers agree on no convention, so the keys are configuration:
The defaults cover the common cases, including the written by medusa-inpost-fulfillment, so a Paczkomat order works without configuring anything. Dotted paths reach a nested value (). An order delivered to an address names no point and is unaffected.
Only the id is sent. Base also stores a point name and address, but carrier plugins do not consistently keep them, so those fields stay empty — the id is what a shipment needs.
Base never takes money. Payment runs through a Medusa provider, and Base is only told the operational consequence: what has been collected, and whether the courier still has to collect the rest.
has to be configured if you sell cash on delivery. Medusa has no such concept — it is a manual provider, a custom one, or sometimes a shipping option — so the plugin cannot infer it. The flag decides whether the courier collects money on delivery and what goes on the label: a cash-on-delivery order sent as prepaid ships without collecting anything.
What Base receives:
| Order | Amount recorded as paid | |
|---|---|---|
| Provider listed in | yes | 0 |
| Payment captured | no | the captured amount |
| Payment authorized but not captured | no | 0 |
An authorization is money reserved, not money taken, so it counts as unpaid — the warehouse cares about what has actually arrived.
The amount is sent with a separate call, because accepts a field and silently ignores it. A payment captured after the order was exported is not pushed to Base; record it there by hand.
The repository carries recorded API responses in , so the mapping layer is fully testable without a Base account:
Two scripts talk to a real account:
The seeded products are chosen to hit specific edge cases: a product without variants, variants with and without consistent features, two products sharing a name, diacritics in a title, stock split across warehouses, and a price that differs per price group.
attaches a parcel with , which records a tracking number without contacting any courier, so it cannot produce a billable shipping label.
Setting this up in a live store — mapping your Base statuses, configuring the automatic actions that turn an order into a shipment, or adapting the plugin to how your warehouse actually works — is something we do for a living.
If you would rather not do it yourself, get in touch at digity.studio.
Bug reports and questions about the plugin itself belong in GitHub issues and are free.
MIT
npm install medusa-baselinker1module.exports = defineConfig({2 plugins: [3 {4 resolve: "medusa-baselinker",5 options: {6 api_key: process.env.BASE_API_KEY,7 },8 },9 ],10})1select medusa_order_id, export_error from base_order_mapping2where export_error is not null;pickup_point_data_keys: ["target_point", "point_id", "pickup_point_id"],1cod_payment_providers: ["pp_system_default"],2payment_method_labels: { pp_system_default: "Cash on delivery" },npm test1npm run recon # dump API responses into fixtures/2npm run seed # show what test products would be created3npm run seed -- --setup # add a second warehouse and price group4npm run seed -- --apply # create the test products5npm run seed -- --order # create one test order with a manual parcel6npm run seed -- --cleanup # remove only what the seed created