PF

PayFlow Console

Double-Entry Ledger Active

Java 21 · Spring Boot 3.5 · PostgreSQL 16 · Redis 7 · Apache Kafka (KRaft) · Resilience4j

∑ Global Ledger Sum: ₹0.00 (Balanced) GitHub (24f2006816/payflow)
CUSTOMER_WALLET 3333…3333
₹425.00
42,500 paise · No-Overdraft
PLATFORM_HOLDS Auth Escrow
₹0.00
0 paise · Reserved Funds
MERCHANT_BALANCE Acme Foods
₹73.00
7,300 paise · Settled Net
PLATFORM_FEES 200 bps (2%)
₹2.00
200 paise · Revenue
PSP_CLEARING External PSP
-₹500.00
-50,000 paise · Receivable

Interactive Payment Operations

Execute idempotent API calls against the double-entry engine

Last API Response & Headers HTTP 200 OK · Idempotent-Replayed: false
{
  "status": "PASSED",
  "accountsChecked": 9,
  "mismatches": 0,
  "globalPostingSum": 0,
  "activePayment": {
    "id": "ca89b5d5-3fd4-46fc-8e83-e3e6f465216a",
    "status": "PARTIALLY_REFUNDED",
    "amountMinor": 12000,
    "capturedMinor": 10000,
    "refundedMinor": 2500,
    "feeMinor": 200
  }
}

Immutable Double-Entry Ledger Postings

Enforced by PostgreSQL DEFERRABLE INITIALLY DEFERRED trigger (SUM(amount_minor) = 0)

4 Journal Entries
Journal Entry Operation Account Signed Delta (Minor) Entry Sum

Transactional Outbox → Kafka → HMAC-SHA256 Webhook Sink

Topic: payflow.payment-events · Header: PayFlow-Signature: t=<epoch>,v1=<hmac_sha256>

200 OK Delivered
POST /hooks/acme HTTP/1.1
Host: webhook-sink:8080
Content-Type: application/json
PayFlow-Event-Id: 76712acf-c3ea-4a4b-85e7-9c154f7c7ceb
PayFlow-Event-Type: payment.captured
PayFlow-Signature: t=1794126879,v1=e7c29fff5201424d08df02c2ea13f451ef5bd4ab9c2852e363be55e5d7e836fa

{
  "id": "76712acf-c3ea-4a4b-85e7-9c154f7c7ceb",
  "type": "payment.captured",
  "merchantId": "11111111-1111-1111-1111-111111111111",
  "aggregateType": "payment",
  "aggregateId": "ca89b5d5-3fd4-46fc-8e83-e3e6f465216a",
  "data": {
    "paymentId": "ca89b5d5-3fd4-46fc-8e83-e3e6f465216a",
    "status": "CAPTURED",
    "amountMinor": 12000,
    "capturedMinor": 10000,
    "feeMinor": 200,
    "currency": "INR"
  }
}