Open source  /  Implementation guide

Open-source implementation · Integration audits

Audit a functional integration on open source

What this is. A build-it-yourself path to the same outcome, made from open-source parts you host. It does not publish 5 Kings’ internal method, client data, or any third party’s confidential information — and it says plainly where the open-source path is weaker than a specialist service.

In one paragraph

Payments, tax, search, returns, support, reviews, attribution, migration — the functional layer is where commerce quietly breaks. An integration audit is mostly plumbing work: find the contract, watch the traffic, and prove each side agrees. All of it can be done with open-source tools you run yourself.

What you end up with

  • A written contract per integration: endpoint, payload, auth, retry behaviour, owner
  • A captured trace of a real transaction through every hop, with timings
  • A failure-mode list including what happens at 3am when the provider 500s
  • A replay harness that proves a fix before it ships

The reference stack

Every project below is open source and self-hostable. Licences are the ones the project publishes today; check them against your own distribution model before you ship, because a licence can change and an AGPL project has obligations a MIT project does not.

LayerOpen-source projectLicenceWhat it does for you
Traffic capturemitmproxyMITIntercept and inspect HTTPS API calls between platform, app and provider; script assertions over captured flows.
Contract testingPact (contract testing)MITRecord what the consumer expects and verify the provider still satisfies it, before a provider change breaks checkout.
Payload validationJSON Schema / AjvMITAssert every webhook and API payload shape, so a silently nullable field is a failed test rather than a lost order.
Queue + retryRabbitMQ or NATSMPL-2.0 / Apache-2.0Buffer outbound calls so a provider outage becomes a delay rather than a lost transaction.
Reconciliationdbt-core + a warehouseApache-2.0Match orders, payments and refunds across systems daily; the unmatched set is the bug list.
Webhook replayyour own CLI + platform sandboxn/aReplay captured payloads at a sandbox endpoint to reproduce a failure deterministically.

Build it

1. Write the contract before touching anything

For each integration: direction, endpoint, auth method, payload sample, idempotency key, retry policy, timeout, and who is paged when it fails. Most integration incidents are a missing line in this document, not a code bug.

2. Capture one real transaction end to end

Run a test order through the live path with the proxy in place and record every hop with timings. You now have a factual baseline: which system is slow, which one calls twice, which one silently drops a field.

3. Turn the capture into assertions

Each captured payload becomes a schema assertion plus a few value rules (currency present, totals reconcile, idempotency key unique). Wire them into the provider’s sandbox so the assertion runs on every push.

4. Test the failure paths deliberately

Timeout, 500, 429, malformed payload, duplicate webhook, out-of-order webhook. Six scenarios per integration, all automated. This is where the honest answer to “is the integration resilient” gets produced.

5. Reconcile daily

One query that matches orders to payments to refunds across systems. Any unmatched row is either a bug or a business event nobody recorded; both need an owner. Publish the daily count.

6. Document the blast radius

If this integration goes down, what exactly stops working, and what does the customer see? That sentence belongs on the runbook, not in an architect’s head.

Acceptance checks

If you cannot verify a claim, it is not a finding. These are the checks that close the work; each one can be run by somebody who did not build it.

Acceptance checkHow to verify it
Every integration has a contract with auth and retry definedRepository checklist; a missing section fails review.
A captured trace exists for the happy pathStored HAR/mitmproxy flow per integration, dated, with the release it was taken from.
All six failure scenarios have an automated testTest suite count per integration = 6; skipped tests are counted as missing.
Webhook payloads validate against schemaAjv validation in the test suite, plus a production sampler that logs violations.
Daily reconciliation unmatched count is published and zero or explaineddbt test + a dashboard tile; every non-zero day needs a note.
Retry and idempotency verified by replayReplay the same payload twice and assert one effect, not two.

Effort and cost

Estimate
Skill neededAdvanced: HTTP, auth flows, queues, SQL
Build time1–2 days per integration for contract + assertions; 1 day for the reconciliation models
Running costReconciliation daily (automated); contract review on every provider change
What you must hostProxy on a laptop, queue and dbt on a small VM. No paid services required.

What open source does not give you

The honest half of the comparison. Each of these is a reason somebody buys the service instead of building it, and pretending otherwise would make the rest of this page worthless.

  • You cannot proxy a provider that pins certificates or blocks non-browser clients. For those, the audit falls back to sandbox logs and provider-side dashboards.
  • Some platforms do not expose webhooks for every event (refund settlement and chargeback states are the usual gap). Absence of an event is not absence of a problem.
  • Pact-style contract testing only helps if both sides are testable. A closed SaaS provider will change under you, and the contract test is then a detector, not a preventer.
  • Reconciliation tells you that something is wrong; it cannot tell you which system is wrong. That still takes a human reading logs.

Scope only, stated so you can compare it with the build above.

  • A written contract and failure matrix for each integration, reviewed against the platform’s actual behaviour
  • The reconciliation queries wired to your real order and settlement data, with the unmatched set triaged
  • Verification after each fix, with the before and after captured

Sources and further reading

What this page does not include. This guide documents an open-source implementation of the same outcome. It deliberately leaves out 5 Kings’ internal playbooks, client data, vendor terms and unpublished method: we publish what any competent team can reproduce, and we do not publish what belongs to a client or to a contract. Where a step depends on a decision only your business can make, the guide says so instead of guessing.

Take it with you

Audit a functional integration on open source

The full guide as an A4 PDF: the reference stack with licences, the build steps, the acceptance checks and the honest limits — in one file you can hand to an engineer or print for a planning session.

PDF · A4 · no email required · free to redistribute with attribution

Open-source Guides & PDFs