Documentation contents

Integration guide

JavaScript, Python and Postman examples

Download the examples from Resources. Run them on your server with MEREU_API_URL=https://mereu.md/api/v1 and the key in MEREU_API_KEY.

FilePurpose
mereu-client.mjs / mereu-client.pyAuthentication, requests and GET query encoding.
crm-sync.mjs / crm-sync.pyOne snapshot or changes page with a durable checkpoint.
pos-checkout.mjsReservation, sale commit, purchase import and refunds.
mereu-postman.jsonManual requests with references, UUIDs and amounts to fill in.

For Python imports, rename the modules to mereu_client.py and crm_sync.py. Python module names cannot contain hyphens.

  • CRM: load the saved state and call syncMereuPage(api, resource, state, commitPage) or sync_mereu_page(api.request, resource, state, commit_page).
  • state=null / None starts a snapshot. Each call processes ONE page and returns phase and cursor.
  • In the callback, reset staging on reset=true, add non-deleted rows and replace the active dataset only on complete=true. In changes mode, apply inserts, updates and deletes.
  • Commit the checkpoint with the data in one transaction. Let save errors propagate. Schedule the next page in your job queue within the request limit.
  • POS: prepareCheckout sends only preview, reservation and payment-started through your durable persist callback.
  • Supply UUIDs from your persisted order. Start payment in your system only after the function succeeds and the journal commits.
  • After verifying payment, call commitVerifiedPayment. Use recordVerifiedPurchase for paid imports and recordVerifiedReturn for verified returns.
  • A journal failure after a response may mean the operation was already applied. Recover the saved request and read its status before replaying it.

In Postman, fill the empty variables and integer money amounts. For commit, copy expected_paid_total from the quote and the revision from payment-started. For refunds, use the original eligible allocation and actual returned cash.