Qeasy Cloud
Get Started

Reverse Sync of Sales Refund Orders from E-commerce ERP to Finance ERP

· 高金凤· Integration Solutions· 26 views· 4 min read

What This Strategy Solves

When a refund happens on the e-commerce front end, the document first lands in the e-commerce ERP. But the AR write-off and reconciliation against the customer ledger must happen in the finance ERP. The real problem we saw on-site: both sides entered documents manually, and three months later the refund amounts did not match, making reconciliation extremely expensive. This strategy has a single goal — reverse-sync the audited sales refund orders from the e-commerce ERP and auto-generate receipt/refund documents in the finance ERP, so one approval drives both sides and vouchers can flow downstream automatically.

Data Flow and Field Mapping

The flow is: E-commerce ERP (source) → Qeasy Data Integration Platform (middleware) → Finance ERP (target). The middleware does not run business calculations; it translates fields, fills missing codes, handles idempotency, and routes exceptions.

The source side pulls refund orders incrementally by creation time window, only those with audit status = approved and no restriction on write-off status. The middleware translates store codes, organization codes, and customer codes uniformly, then writes through the target's batch save API. Here are the key fields:

Business MeaningSource Field (E-commerce ERP)Target Field (Finance ERP)Mapping Note
Refund numbercodeFBillNoPassed through directly; serves as idempotency key
Document type—FBillTypeIDConstant SKTKDLX01_SYS, written by the middleware
Business daterecordedTimeFDATENormalized to yyyy-MM-dd
Store / Orgshop.codeFSETTLEORGID, FSALEORGIDManaged via a centralized mapping table
Audit timeauditTime—Used only as a filter; not written to target

We strongly recommend keeping all code mappings in Qeasy's centralized Data Mapping module. One change applies to every strategy, instead of scattering logic across many places.

How to Configure It on Qeasy

Source API: the e-commerce ERP's gy.erp.finance.billFlowList.get, a POST query that fetches by createBeginDate ~ createEndDate. auditStatus=2 means approved — do not skip this filter, or draft records will corrupt the downstream ledger. Enable idCheck and use the document number as the primary key.

Target API: the finance ERP's batchSave, which writes receipt/refund documents in batch. idCheck=true is controlled by the platform using the document number for idempotency, so duplicate pushes will not create duplicates. We emphasized this on-site.

Middleware:

  • Split header and body into two phases. If the order is wrong, you will see orphan body rows attached to empty masters — ugly dirty data.
  • Route store codes and org codes through a mapping table rather than hard-coding them in scripts.
  • Failed rows go to a dedicated exception table for manual or replay recovery. Never roll back the whole batch on a single row error.

Implementation Steps

On-site, we typically proceed in three steps to keep things stable:

  1. Incremental starting point: on first go-live, backfill the last 30 days in full as a baseline; after that, take the window from yesterday 00:00 to now. The window must align with the source's createTime. Do not use modifyTime, or the same document will be fetched multiple times.
  2. Full resync: at the initial rollout, or whenever the org-code mapping is adjusted, trigger a full resync manually. Do not run it on a daily schedule.
  3. Scheduling cadence: the source side runs in the early morning to avoid e-commerce peak hours; the target side runs on an hourly polling-and-recovery cadence to catch network-jitter losses. Do not schedule the two at the same minute — leave a processing buffer.

Pitfalls We Have Seen

  • Filtered on audit status but forgot write-off status — a classic mistake: pulling only audited records meant fully written-off refunds were pushed again, doubling up downstream. The safe approach is to add a "not fully written off" filter on the source side.
  • Store codes scattered across many strategies — once the org structure was adjusted, a single refund strategy required changes in dozens of places. Later the customer centralized all org mappings into one table; new strategies simply reference it, and the change volume dropped by an order of magnitude.
  • Header/body write order reversed — looks like a technical issue, but it is really a process design issue. We recommend splitting header and body into two phase tasks in Qeasy: header first, then body, with failures re-entrant.
  • Time zone mismatch — the source is UTC+8, and the target date field is a string. One time we forgot to normalize the format and a batch of documents landed in the previous month, breaking month-end reconciliation. Explicitly format once in the middleware.
  • Wrong idempotency key — code is correct, but some teams pick id. When a source document is unaudited and rebuilt, id changes, causing duplicate inserts. We standardize on the business document number code as the idempotency key.

When This Applies — And When It Does Not

Applies: retail enterprises where the e-commerce front end and finance back end are separated, refund volume is high, and reconciliation must be near real-time; multi-store organizations under one legal entity that need centralized bookkeeping and where refund orders must enter the finance system's AR / receipt module.

Does not apply: if a single ERP already covers both e-commerce and finance, the middleware is just overhead; if refunds require multi-level approval before booking, a single-step sync is not enough and an approval-callback strategy must be layered on top; if the source has no standard audit-status field, you cannot use audit as a filter and the incremental logic must be redesigned.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-guanyi-kingdee-cloud-4203-n67d1ef73-53b8b2f1

Comments