These endpoints handle outbound synchronization from ERPNext to Medusa. The primary endpoint pushes Sales Order status and payment status back to the Medusa storefront. A secondary utility endpoint bulk-syncs item prices that were created before the Medusa price ID was recorded.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.
Both endpoints are decorated with
@frappe.whitelist(allow_guest=True), but they are primarily invoked by ERPNext document event hooks rather than by the Medusa storefront directly.Export sales order
POST Guest- Sales Order
on_update— whenfrom_ecommerceis set - Sales Invoice
on_submit/on_update— propagates invoice status to the linked Sales Order - Delivery Note
on_submit— propagates delivery status to the linked Sales Order - Payment Entry
on_submit— propagates payment status through the linked Sales Invoice
"Unpaid".
This endpoint sends a POST request to
{medusa_url}/store/order-update?order_id={medusa_order_id} on the Medusa server. The Sales Order must have a medusa_order_id field set for the sync to occur.Request parameters
The ERPNext Sales Order document name (e.g.
"SAL-ORD-2024-00001").Payload sent to Medusa
The following fields are sent to the Medusa order-update endpoint:| Field | Type | Description |
|---|---|---|
customer_id | string | Medusa customer ID from the linked Customer record |
order_status | string | Sales Order status ("Pending" if Draft, otherwise the ERPNext status) |
payment_status | string | Sales Invoice status, or "Unpaid" if no invoice exists |
discount_amount | number | Discount amount on the Sales Order |
net_total | number | Net total before taxes |
grand_total | number | Grand total including taxes |
Example
Sync missing prices to Medusa
POST Guestmedusa_price_id. For each, creates a new price list in Medusa and stores the returned price ID back on the Item Price record.
This endpoint is useful during initial setup or after bulk-importing items to ensure all prices are reflected in Medusa.
No request body is required. The endpoint operates on the full set of qualifying Item Price records and may take significant time to complete for large catalogues. Consider running it during off-peak hours.
Sync criteria
An Item Price is synced if all of the following conditions are met:- The
item_codeis linked to a Website Item with amedusa_variant_id - The price list is
"Standard Selling"with no customer-specific override - The Item Price does not yet have a
medusa_price_id