Lodestar

Payments infrastructure · Architecture reference

LS-ARCH-0031 · Sheet 1 of 1

Drawing

Payment authorization path – v3

Reference drawing for engineers and security review: every hop a card authorization takes on the public API, which hops are on the response path, and what each one is allowed to cost.

Drawing no.
LS-ARCH-0031
Version
v3.0 · supersedes v2.4
Date
2026-09-18
Owner
Payments platform · T. Reinholt
Status
In security review
Reviewers
P. Venkataraman (Security)
M. Lindqvist (SRE)

Scope

Shows
The authorization of a card payment created with POST /v3/authorizations in eu-central-1: the five synchronous hops that decide the response and the asynchronous path that tells the merchant afterwards. Service names are the deployed names in the service registry.
Does not show
Captures, refunds and reversals (LS-ARCH-0029), the 3-D Secure challenge flow (LS-ARCH-0032), settlement files, and the regional failover between eu-central-1 and eu-west-1. Internal retries inside a single service are omitted.
Trust boundaries
Two hops cross a boundary and deserve the most review time: hop 1, merchant to Edge over the public internet, and hop 5, connectors to PSP networks through allow-listed egress. Everything else runs inside the VPC over mTLS. Cardholder data is tokenized at Edge; no service right of Edge sees a PAN in clear text.

Authorization path

  • synchronous call, on the response path
  • asynchronous message
  • trust boundary
  • callout, see notes below

Scroll sideways to see the full drawing

Figure 1. Payment authorization path, v3 Left to right: Client (merchant-server) outside the Lodestar VPC calls Edge (edge-gw) with a synchronous request, callout 1. Edge calls Auth API (auth-api), callout 2. Auth API makes three synchronous calls: up to Risk engine (risk-scorer), callout 3; down to Ledger (ledger-core), callout 4; and right to PSP connector A (conn-north) or PSP connector B (conn-south), callout 5, which call the external PSP A and PSP B acquirer APIs across the trust boundary. Asynchronously, Auth API and Ledger publish events to the event bus, callout 6; the Webhooks service (webhook-dispatch) consumes the bus and posts a signed webhook back to the merchant client. MERCHANT SIDE LODESTAR VPC · EU-CENTRAL-1 · PCI DSS SCOPE PSP NETWORKS Client merchant-server Edge edge-gw Auth API auth-api Risk engine risk-scorer Ledger ledger-core PSP connector A conn-north PSP connector B conn-south PSP A acquirer API PSP B acquirer API EVENT BUS · authorization.* · ledger.* Webhooks webhook-dispatch
FIG. 1Authorization path, v3. Solid arrows are synchronous calls whose response is awaited on the same edge; dashed arrows are asynchronous messages. The dashed frame is the Lodestar trust boundary. Red numbers are the callouts below. Not to scale; node placement follows the request order, not deployment topology.

Callouts

  1. 1Client to Edge

    merchant-server → edge-gw · sync · budget 60 ms

    The merchant server calls POST /v3/authorizations over TLS 1.3 with an Idempotency-Key header. Edge terminates TLS, tokenizes the card fields, enforces the 2 MB body cap and a 300 req/s per-key rate limit, and answers 409 idempotency_conflict if a key is reused with a different body, before anything downstream runs.

  2. 2Edge to Auth API

    edge-gw → auth-api · sync · budget 15 ms

    Inside the VPC the hop is mTLS with workload identities. Edge forwards the tokenized body in a signed envelope carrying the key id, arrival time and client IP; Auth API rejects an envelope older than 5 s. Schema validation and token resolution happen here.

  3. 3Auth API to Risk engine

    auth-api → risk-scorer · sync · budget 120 ms

    A synchronous score call with a hard 120 ms deadline. Below €500 a timeout is fail-open: the authorization continues with a provisional score of 0.5 and a review flag. At or above €500 it is fail-closed and the request is declined with risk_unavailable.

  4. 4Auth API to Ledger

    auth-api → ledger-core · sync · budget 40 ms

    Before any PSP call, Auth API writes a pending hold: double-entry, amount and currency, 7-day expiry. If the write fails the request is declined and no PSP is contacted, so money is never moved without a record. This ordering is the main change in v3.

  5. 5Auth API to PSP connectors

    auth-api → conn-north | conn-south · sync · budget 550 ms

    The router picks connector A or B by BIN range and currency. A 5xx or a 550 ms timeout on the primary triggers one retry on the secondary for dual-routed BINs. Connectors are the only services with egress to PSP networks: allow-listed destination IPs, TLS 1.2 or later, credentials from the vault at start-up.

  6. 6Auth API to Webhooks

    auth-api → event bus → webhook-dispatch · async · budget 10 s

    After the response is sent, Auth API publishes authorization.approved or authorization.declined to the event bus with at-least-once delivery. The dispatcher signs each delivery with the merchant's HMAC secret and retries with exponential backoff for up to 24 hours. The outcome is also readable at GET /v3/authorizations/{id}.

Latency budget

Latency per hop, milliseconds.
Hop Path Mode p50 p95 Budget Share
1merchant-server → edge-gwsync1842607.5%
2edge-gw → auth-apisync49151.9%
3auth-api → risk-scorersync389612015.0%
4auth-api → ledger-coresync1231405.0%
5auth-api → connector → PSPsync21048055068.8%
6auth-api → bus → webhook-dispatch → merchantasync9003,40010,000off path
Synchronous path, end to end282612800100%

p50 and p95 are measured over the 30 days to 2026-09-15 from the tracing sample (1 in 50 requests, eu-central-1); budget is the p95 target each hop owns. The per-hop budgets add to 785 ms; the remaining 15 ms (1.9%) is headroom for Auth API's own work. Per-hop p95 values do not add: the end-to-end p95 in the footer row is measured, not summed. Hop 6 is off the response path and its budget is time to first successful delivery.

Scroll sideways to see the full bar

Figure 2. Allocation of the 800 ms end-to-end p95 budget
FIG. 2Where the 800 ms budget goes. Segments are the per-hop budgets from the table; the red line is the measured end-to-end p95. The PSP round trip owns 69% of the budget, so latency work that does not touch hop 5 cannot move the total by much.

Failure modes

Failure modes on the path, what the merchant sees, and the designed response. Error codes are the public API codes.
What fails What the merchant sees What we do
Risk engine slow or down (hop 3) Under €500: the authorization proceeds and carries a review flag. €500 and above: 402 risk_unavailable, safe to retry. Fail-open below the threshold, fail-closed above it. On-call is paged when the timeout rate exceeds 2% over 5 minutes.
Ledger hold write fails (hop 4) 503 ledger_unavailable. No money has moved. Decline before the PSP call. A retry with the same idempotency key is safe; there is nothing to reverse.
Primary connector returns 5xx or exceeds 550 ms (hop 5) Usually nothing: the request is retried once on the secondary connector. Single-routed BINs get 503 psp_unavailable. The circuit breaker opens after 20 failures in 30 s and sends all dual-routed traffic to the secondary until a probe succeeds.
PSP approves, Auth API fails before responding A timeout. A retry with the same idempotency key returns the stored outcome. The reconciler scans held-but-unanswered authorizations every 60 s and completes them or reverses the hold at the PSP within 5 minutes.
Merchant webhook endpoint unreachable (hop 6) No event arrives. The authorization is complete and readable through the API. Exponential backoff from 30 s to 6 h, for up to 24 h in total. After that the event is parked and listed under failed deliveries in the dashboard.
Idempotency key reused with a different body (hop 1) 409 idempotency_conflict from Edge. Nothing downstream runs. Keys and their body hashes are kept for 24 h in the Edge key store.

Change log

Revisions of this drawing. Earlier revisions are in the architecture repository under the same drawing number.
Version Date Change Author
v3.0 2026-09-18 Ledger hold moved before the PSP call (previously written after the PSP response). Second PSP connector added with BIN-based routing and one cross-connector retry. Webhook delivery moved out of Auth API to the event bus and a dedicated dispatcher. T. Reinholt
v2.4 2026-05-06 Risk budget reduced from 200 ms to 120 ms after the p95 review. Fail-closed threshold set at €500. M. Lindqvist
v2.3 2026-02-11 Idempotency key check moved from Auth API to Edge. 2 MB body cap and per-key rate limit introduced. P. Venkataraman