Use Cases
Reconciliation and accounting
A daily reconciliation job using statements, status endpoints, webhooks and request IDs, and what each mismatch means.
The playbook in one page
Reconciliation is how you prove that what Moolre says happened is what you believe happened. Do it every day, automatically, and make a human look at every difference. This playbook uses the statement, the webhooks, the status endpoints and request IDs to find and fix every kind of mismatch.
| Source of truth | Used for |
|---|---|
| Your database (orders, payouts, invoices) | What you expected: the externalref, amount and status of each |
| Moolre statement (List Transactions) | What actually moved: each row with transactionid, externalref, amount, status and time |
| Payment Status and Transfer Status | The final word on one externalref |
| Webhook deliveries | Which events Moolre sent and which your endpoint missed |
| meta.requestid | Tracing one call with Moolre support |
Step by step: the daily job
- Choose the window: yesterday, midnight to midnight UTC (created_at is UTC with a Z). Using one fixed rule every day means no gaps.
- Download the statement with List Transactions (from, to, limit 100) and walk every page with starting_after until has_more is false. Store the rows.
- Index your own records for the same window by externalref.
- Match each statement row to your record by externalref. Compare amount and txstatus. Mark matches done.
- Collect three lists: rows in the statement you have no record for (unexpected money), records with no statement row (missing money), and rows where the amount or status differs.
- For each of your records still pending, ask Payment Status or Transfer Status by externalref and update it. A pending record with txstatus 1 means you missed a webhook: apply it now, once.
- Check Webhook deliveries for dead events in the window and use Resend webhook; because you dedupe on event_id, resending is safe.
- Compare your computed balance (opening plus collections minus payouts and fees) with Account Status. Any difference is a missing or extra row.
- Report the three lists to a person. Close the day only when they are empty or explained.
const rows = new Map();for await (const row of statement('2026-11-14', '2026-11-14')) rows.set(row.externalref, row); // see Statementsconst problems = { unexpected: [], missing: [], different: [] };for (const [ref, row] of rows) { const mine = await db.findByExternalref(ref); if (!mine) problems.unexpected.push(row); else if (Number(mine.amount) !== Number(row.amount) || mine.status !== statusOf(row.txstatus)) problems.different.push({ mine, row });}for (const mine of await db.findForDay('2026-11-14')) if (!rows.has(mine.externalref)) problems.missing.push(mine);await report(problems); // humans look at every itemWhat each mismatch usually means
| Mismatch | Likely cause | What to do |
|---|---|---|
| Statement row, no record | A customer paid twice, a payment link used by someone else, or a record you failed to save | Find the payer from payer and thirdpartyref; decide whether to credit or return |
| Record paid, no statement row | You applied an event you should not have (a failed callback) or fulfilled from the redirect | Investigate immediately: goods may have been released unpaid |
| Record pending, statement says successful | You missed a webhook | Apply the result once and fix your endpoint |
| Record pending, no statement row | The payment never happened, or is still pending at the network | Ask Payment Status; keep pending until final |
| Amount differs | A partial payment, a fee, or a wrong order amount | Compare amount, value and fee on the row |
| Payout record sent, statement missing | Outcome unknown (PY02, APY16) | Ask Transfer Status by externalref; never resend |
| Balance differs | A missing row, or a fee you did not model | Walk the statement again; check value, fee and networkfee |
Using request IDs in reconciliation
- Log meta.requestid (and your own X-Request-Id) with every request, next to the externalref.
- When a mismatch needs Moolre support, send the meta.requestid, externalref, time and environment.
- Keep the logs long enough to cover your reconciliation window and your dispute window.
Checklist
- A job runs every day over a fixed window and walks every page of the statement.
- Records are matched by externalref and compared on amount and status.
- Unexpected money, missing money and differences each have an owner and a deadline.
- Pending records are re-checked with the status endpoints; missed webhooks are resent.
- The wallet balance equals your computed balance.
- meta.requestid and externalref are in your logs for every call.