This page covers the two ways Item Price records are pushed from ERPNext to Medusa: automatically when a price is saved, and on-demand via a bulk sync endpoint that catches any prices that were missed during initial import.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/aerele/medusa_integration/llms.txt
Use this file to discover all available pages before exploring further.
POST sync missing prices to Medusa
POST /api/method/medusa_integration.api.sync_missing_prices_to_medusa
Identifies Website Items that have a medusa_id but whose Item Price records have no medusa_price_id, then creates Medusa price lists for them. Use this endpoint after a bulk item import to catch any prices that were not synced automatically.
This endpoint is open to unauthenticated callers (
allow_guest=True). Restrict it at the network or firewall level if needed.- Fetches all Website Items that have
medusa_idset. - Finds
Standard SellingItem Price records for those items wherecustomeris empty andmedusa_price_idis not yet set. - For each unsynced price, calls
POST /admin/price-listson the Medusa Admin API. - Writes the returned
prices[0].idback to themedusa_price_idfield on the Item Price record.
Response
This endpoint has no explicit return value. All work is performed as side effects — Item Price records are updated in place.Automatic price sync on Item Price save
Price records are also synced to Medusa whenever an Item Price document is saved in ERPNext. This is driven by thevalidate document event defined in hooks.py:
hooks.py
Sync conditions
Only Item Prices that match all of the following criteria are pushed to Medusa:price_listisStandard Sellingcustomeris empty (no customer-specific pricing)- The Website Item for the
item_codehas amedusa_variant_id
Price conversion
Medusa stores monetary amounts in the smallest currency unit (for example, baisa for OMR). The ERPNext price is converted with:1.500 OMR becomes 1500 in Medusa.
Create vs. update
| Condition | Action |
|---|---|
medusa_id is not set on the Item Price | Calls POST /admin/price-lists to create a new price list; stores the returned ID in medusa_id and medusa_price_id. |
medusa_id is already set | Calls POST /admin/price-lists/{medusa_id} to update the existing price list in place. |
Medusa payload
GET get Medusa prices
GET /api/method/medusa_integration.api.get_medusa_prices
Returns live ERPNext prices for a list of Medusa product or variant IDs, including customer-specific negotiated prices and a payment URL when a draft order is provided.
See Quotations for full documentation on this endpoint.