Skip to content
PreviewFix
Tenders, planning, escrow & API integration6 min readReviewed

Holding supplier payouts until completion is proven.

Inside the Group B managed-service state machine (held → release_pending → released or refund_pending → refunded): how principal-of-record contracting, completion proof gates and idempotent transfers protect buyers.

  • Principal & MoR
  • State machine invariants
  • Idempotent payouts
  • Auto deadline refund

Key engineering takeaways

Summary
  • We contract on every Group B order as contracting principal and merchant of record — never as a peer-to-peer marketplace or payment aggregator — so you receive one VAT-inclusive receipt and one accountable counterparty.
  • A payout hold (escrow_holds) can only open after buyer funds are captured (order.paidAt), is constrained one-per-order by a unique database index, and enforces payoutMinor < priceMinor in matching currency.
  • Upstream carriers, print bureaux, translators and specialists are paid only when objective proof passes the pipeline's release gate using deterministic idempotency key escrow-release-<holdId>.
  • If the order's refund_deadline passes without passing proof, the sweeper transitions held → refund_pending → refunded (escrow-refund-<holdId>) automatically; raising a dispute (disputed) freezes all automated money movement.

Published by MeWeBe Limited · Factual engineering reference

1. Principal & Merchant of Record versus marketplace introductions

Buying one-off operational jobs — collecting an unboxed machine from a collection-only seller, printing an obsolete bracket, translating a notarised corporate extract, sourcing a European OEM salvage module or migrating off a legacy SaaS tool over a weekend — normally forces a business to vet an unfamiliar subcontractor, pay upfront on bank transfer and chase refunds alone if a deadline slips.

Across all eight Group B managed services (/services#managed), we sell the complete service directly to you as principal and merchant of record at a locked quote or fixed price (Stripe Checkout or PayPal, zero surcharges). Behind the scenes, our orchestrator dispatches execution to vetted carriers, print bureaux, translators, equipment suppliers or migration specialists while keeping supplier settlement locked behind an internal payout-hold state machine (packages/payments/src/escrow.ts).

2. The six-state hold machine and crash-safe idempotency

Financial state machines fail in production when network timeouts occur mid-transfer or retry workers pay a supplier twice. Our escrow_holds implementation enforces four strict database and code invariants:

  • Invariant 1 — Capture before hold: openHold() verifies order.paidAt inside a row-locked transaction and refuses any hold where payout.amountMinor >= order.priceMinor or currencies mismatch.
  • Invariant 2 — Unique per order: A unique index on escrow_holds.order_id makes it impossible to open two supplier payout records for the same customer order.
  • Invariant 3 — Two-phase pending settlement: Recording the gate decision (release_pending or refund_pending) commits to PostgreSQL before any external transfer or refund call runs, keyed by escrow-release-${holdId} or escrow-refund-${holdId}.
  • Invariant 4 — Dispute freeze: Once flagDisputed() sets status = "disputed", automated sweepers cannot release supplier funds; only an operator review can return the hold to held or trigger refund_pending.
Group B payout-hold transitions (packages/payments/src/escrow.ts)Specimen
// Allowed state transitions (enforced by assertTransition + SELECT ... FOR UPDATE row lock):
//   held ──(release gate passes)──────────▶ release_pending ──(transfer confirmed)──▶ released
//     ├───(gate rejects / deadline passes)▶ refund_pending  ──(refund confirmed)────▶ refunded
//     └───(buyer reports issue)───────────▶ disputed        ──(operator decision)───▶ held | refund_pending

const releaseIdempotencyKey = (holdId: string) => `escrow-release-${holdId}`;
const refundIdempotencyKey  = (holdId: string) => `escrow-refund-${holdId}`;

// Step 1 (DB transaction): recordDecision() moves held -> release_pending or refund_pending. Zero money moves here.
// Step 2 (Provider call):  settlePending() calls transfer() or refund() with the deterministic idempotency key.
// If a worker crashes between Step 1 and Step 2, the sweeper replays the exact idempotent call safely.

3. What counts as objective completion proof per Group B service

Each Group B pipeline defines proofRequired at hold creation and merges partner webhooks or verification artefacts via attachProof() before running its release gate:

SPEC · PAY-HOLD-11 · Reviewed 18 November 2026

Group B release-gate evidence matrix

Objective proof checked before supplier payout is released on each managed service

Engineering checklist
Managed serviceFulfilled byRequired release-gate proofMissed-deadline outcome
Collection-Only & Same-Day CouriersVetted carrierCarrier collection scan + destination GPS/signature or recipient PIN scanAuto full refund if uncollected
Discontinued Spare Parts (3D Printed)Print bureauMesh manifold/dimension pass + tracked postal dispatch & delivery eventHeld until dispatched
Express & Certified TranslationHuman translatorTarget-language file + signed Statement of Accuracy (on Certified tier)Deadline-protected
48-Hour SaaS Migration DeskMigration specialistAutomated DNS cutover check, API health check & source-vs-target record count matchDeterministic verification
OEM Salvage, Event Gear & Micro-SprintSupplier / specialistCustoms/delivery scan, kit drop-off & return log, or scored test / room-by-room photosDispute freeze available

How to track or query a Group B managed order

  • Lock your live quote on the /tools/* page before checkout; if an upstream carrier quote expires (QuoteExpired), generate a fresh quote before paying.
  • Open /portal via your checkout email's magic sign-in link to view live escrow_held, proof and completion events.
  • Keep your XX-XXXXXX order reference handy if you need to report a delivery issue before settlement completes.
  • Remember sandbox mode (SandboxFulfilmentRefused) hard-blocks paid fulfilment whenever a live partner integration is not connected.

Operated as contracting principal and merchant of record under the laws of England and Wales — see /legal/terms §6 and /legal/refunds.

Technical questions

Common edge cases & boundaries

Do I ever receive a separate surprise invoice from the courier, translator or print bureau?
No. You contract with and pay us once at the price shown at checkout (inclusive of UK VAT where applicable, with zero card or PayPal surcharges). Upstream partner settlement happens separately from our own account once completion proof clears.
What happens if an upstream carrier fails to collect within the agreed window?
When refund_deadline expires without passing proof (or the gate returns a refund decision), the hold moves to refund_pending and returns 100% of your payment to your original card or PayPal account automatically.
Can a supplier get paid while an order is under dispute?
No. disputed has zero outgoing transition to release_pending or released in TRANSITIONS; automated payout workers skip disputed holds completely.

Continue reading

Related technical guides.

7 min read

3D-printed spare parts: materials & licensing

How to match polymer thermal, UV and mechanical properties (PETG, ABS, ASA, SLS Nylon PA12 and TPU 95A) to non-safety replacement clips, brackets and trims, verify STL/3MF manifold meshes, and respect CAD licensing.

8 min read

BYOK vs prepaid credits: micro-API & licences

How our 25 HTTP engine endpoints separate zero-LLM deterministic checks from optional AI operations, how Bring-Your-Own-Key (BYOK) vs prepaid credits prevent surprise overage bills, and how AKL1 Ed25519 tokens verify offline.

7 min read

Wholesale PDF to ERP & storefront CSVs

How multi-page PDF table geometry, multilingual column header normalisation and integer minor-unit arithmetic work together so wholesale catalogues and supplier bills import cleanly into Shopify, WooCommerce, Xero and NetSuite.

Request a quote · No payment taken

Confirm availability & firm price first.

Send your brief to see an indicative non-binding guide range with zero online payment. Our UK team confirms partner availability and emails a firm written price before you decide.