<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kwaku Essah</title>
    <description>The latest articles on DEV Community by Kwaku Essah (@hexstories).</description>
    <link>https://dev.to/hexstories</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2741117%2F8a80a72d-984b-435a-990d-a5bd7324214c.png</url>
      <title>DEV Community: Kwaku Essah</title>
      <link>https://dev.to/hexstories</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hexstories"/>
    <language>en</language>
    <item>
      <title>FINTECH 101 — HOW TRANSACTIONS REALLY WORK</title>
      <dc:creator>Kwaku Essah</dc:creator>
      <pubDate>Thu, 18 Dec 2025 16:06:12 +0000</pubDate>
      <link>https://dev.to/hexstories/fintech-101-how-transactions-really-work-lj4</link>
      <guid>https://dev.to/hexstories/fintech-101-how-transactions-really-work-lj4</guid>
      <description>&lt;p&gt;You click &lt;strong&gt;Pay&lt;/strong&gt; and see &lt;em&gt;Success&lt;/em&gt; in under a second.&lt;br&gt;
But behind that &lt;strong&gt;green checkmark&lt;/strong&gt; is a system that may take minutes, or hours to actually settle money.&lt;/p&gt;

&lt;p&gt;In fintech, &lt;em&gt;nothing is truly instant&lt;/em&gt;. &lt;br&gt;
What looks instant is &lt;strong&gt;well-engineered state management&lt;/strong&gt;.&lt;br&gt;
This article explains how real payment systems work, and why naïve implementations fail.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Core Mental Model&lt;/strong&gt;&lt;br&gt;
Every fintech payment system regardless of country, bank, or processor is built on &lt;strong&gt;four pillars&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Transaction statuses&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2.    Callbacks / Webhooks&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;3.    Reconciliation &amp;amp; Status Enquiry&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;4.    Retries, reversals &amp;amp; idempotency&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you misunderstand even one of these, you will eventually lose money.&lt;/p&gt;

&lt;p&gt;Let’s break it down&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;1. TRANSACTION STATUSES (Not Responses)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Many developers think:&lt;br&gt;
“The processor responded, so the transaction is done.”&lt;/p&gt;

&lt;p&gt;That is wrong.&lt;br&gt;
&lt;em&gt;Processors lie.&lt;br&gt;
Networks fail.&lt;br&gt;
Banks respond late&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So in Fintech we track &lt;strong&gt;STATES&lt;/strong&gt;, not just responses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Canonical Transaction Lifecycle&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;INITIATED&lt;/strong&gt;   → request created internally&lt;br&gt;
&lt;strong&gt;PROCESSING&lt;/strong&gt;  → sent to processor&lt;br&gt;
&lt;strong&gt;PENDING&lt;/strong&gt;     → processor accepted but not final&lt;br&gt;
&lt;strong&gt;SUCCESS&lt;/strong&gt;     → money confirmed delivered&lt;br&gt;
&lt;strong&gt;FAILED&lt;/strong&gt;      → money not delivered&lt;br&gt;
&lt;strong&gt;REVERSED&lt;/strong&gt;    → money taken then returned&lt;br&gt;
&lt;strong&gt;TIMEOUT&lt;/strong&gt;     → no response within SLA&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What These Status Actually means&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;INITIATED&lt;/td&gt;
&lt;td&gt;Your system created the transaction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PENDING&lt;/td&gt;
&lt;td&gt;Processor or network is still working&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SUCCESS&lt;/td&gt;
&lt;td&gt;Value delivered (airtime, data, money)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FAILED&lt;/td&gt;
&lt;td&gt;Value was NOT delivered&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;REVERSED&lt;/td&gt;
&lt;td&gt;Money was taken but refunded&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Golden Rule&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A transaction can only end in &lt;strong&gt;SUCCESS or FAILED (or REVERSED)&lt;/strong&gt;&lt;br&gt;
Everything else is &lt;strong&gt;temporary&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  2. Response Codes ≠ Business Status
&lt;/h2&gt;

&lt;p&gt;This distinction is critical.&lt;/p&gt;

&lt;p&gt;In fintech systems, a request can be technically successful while the financial action itself does not complete. Cases like insufficient funds, pending bank confirmation, or failed compliance checks are normal business outcomes, not system errors.&lt;/p&gt;

&lt;p&gt;Using HTTP response codes to show technical success and business status to show transaction outcome prevents confusion, avoids unsafe retries, and makes payment flows easier to reason about.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Response Code&lt;/td&gt;
&lt;td&gt;Technical result&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Status&lt;/td&gt;
&lt;td&gt;Business state&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;HTTP Response&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;200 OK&lt;/td&gt;
&lt;td&gt;Request was processed successfully at a technical level&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;br&gt;
HTTP 200 OK&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; {
 "code": "99",
"status": "PENDING"
"message": "Transaction is being processed"
 }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HTTP 200&lt;/strong&gt; only means “we heard you”.&lt;br&gt;
It does &lt;strong&gt;not&lt;/strong&gt; mean the transaction succeeded.&lt;br&gt;
 &lt;strong&gt;Status is the source of truth&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  3.MONEY &amp;amp; DATA TYPES (The Silent Fintech Killer)
&lt;/h2&gt;

&lt;p&gt;There is one rule you must never break in fintech.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NEVER use Floats or Doubles for money.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem&lt;/strong&gt; Computers use binary (base-2). Humans use decimal (base-10). Some simple decimals cannot be represented perfectly in binary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this destroys you:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;       You charge 100.00&lt;/li&gt;
&lt;li&gt;    Calculate a 1% fee → 1.000000001&lt;/li&gt;
&lt;li&gt;    DB rounds it&lt;/li&gt;
&lt;li&gt;   Ledger mismatch occurs&lt;/li&gt;
&lt;li&gt;   At scale, your accounting breaks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Correct Approach: Minor Units&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Always store money in the smallest currency unit.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Wrong (float)&lt;/th&gt;
&lt;th&gt;Right (integer)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;10.50&lt;/td&gt;
&lt;td&gt;1050&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Rule of thumb:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Database: BIGINT (1050)&lt;/li&gt;
&lt;li&gt;  Code: Integer math (1050 + 20)&lt;/li&gt;
&lt;li&gt;  Frontend: Convert only for display ( GH₵10.70)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. CALLBACKS / WEBHOOKS (ASYNC TRUTH)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a callback?&lt;/strong&gt;&lt;br&gt;
A callback (webhook) is when the processor says:&lt;br&gt;
“Remember that transaction?&lt;br&gt;
I have the FINAL answer”&lt;/p&gt;

&lt;p&gt;This happens when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transaction are pending&lt;/li&gt;
&lt;li&gt;  Networks delay&lt;/li&gt;
&lt;li&gt;  Banks go offline&lt;/li&gt;
&lt;li&gt;  Switch timeout&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Typical callback flow&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You send request&lt;/li&gt;
&lt;li&gt;Processor responds → PENDING&lt;/li&gt;
&lt;li&gt;You save transaction as PENDING&lt;/li&gt;
&lt;li&gt;Later…&lt;/li&gt;
&lt;li&gt;Processor calls YOUR endpoint&lt;/li&gt;
&lt;li&gt;You update transaction → SUCCESS / FAILED&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  5. STATUS ENQUIRY (When Callbacks Fail)
&lt;/h2&gt;

&lt;p&gt;Callbacks fail often:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Network issue&lt;/li&gt;
&lt;li&gt;  Downtime&lt;/li&gt;
&lt;li&gt;  Processor bug&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So fintech systems also use status enquiry.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Callbacks: PUSH (they tell you)&lt;/li&gt;
&lt;li&gt;  Status enquiry: PULL (you ask them)
This is how you recover truth.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  IDEMPOTENCY(Prevent Double Charges)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The nightmare scenario...&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User clicks “Pay”&lt;/li&gt;
&lt;li&gt;  Network glitches&lt;/li&gt;
&lt;li&gt;  User clicks again&lt;/li&gt;
&lt;li&gt;  Two charges happen&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Solution: Idempotency Key&lt;/strong&gt;&lt;br&gt;
Each transaction must have a unique reference.&lt;/p&gt;

&lt;p&gt;Rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reject duplicate references&lt;/li&gt;
&lt;li&gt;  Enforce DB uniqueness&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;UNIQUE(reference)&lt;br&gt;
Same request → same result → no double charge&lt;/p&gt;




&lt;h2&gt;
  
  
  7. RETRIES
&lt;/h2&gt;

&lt;p&gt;Retries are dangerous.&lt;br&gt;
 Retry ONLY when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No response&lt;/li&gt;
&lt;li&gt;  Timeout&lt;/li&gt;
&lt;li&gt;  Network error&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Never retry on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SUCCESS&lt;/li&gt;
&lt;li&gt;Business failure (insufficient funds, wrong PIN)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Retries without rules create duplicate debits.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. REVERSALS
&lt;/h2&gt;

&lt;p&gt;A reversal means:&lt;br&gt;
Money was debited, but value was not delivered.&lt;br&gt;
This is the most serious failure mode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to reverse&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  SUCCESS debit&lt;/li&gt;
&lt;li&gt;  FAILED delivery&lt;/li&gt;
&lt;li&gt;  No callback after SLA&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Reversal flow&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Detect mismatch&lt;/li&gt;
&lt;li&gt; Call reversal API&lt;/li&gt;
&lt;li&gt; Update transaction → REVERSED&lt;/li&gt;
&lt;li&gt; Notify user&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  9. RECONCILIATION
&lt;/h2&gt;

&lt;p&gt;Your records will &lt;strong&gt;never perfectly match&lt;/strong&gt; the processor’s.&lt;br&gt;
So you reconcile:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;   &lt;strong&gt;Amount&lt;/strong&gt;  &lt;strong&gt;Status&lt;/strong&gt;&lt;br&gt;
TX123        50        SUCCESS&lt;br&gt;
TX124        100       FAILED&lt;/p&gt;

&lt;p&gt;Any mismatch:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Investigate&lt;/li&gt;
&lt;li&gt;Reverse or correct&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is &lt;strong&gt;financial integrity&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  10. LOGGING &amp;amp; AUDIT TRAILS
&lt;/h2&gt;

&lt;p&gt;Every fintech system must log:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Request payload&lt;/li&gt;
&lt;li&gt;  Response payload&lt;/li&gt;
&lt;li&gt;  Status transitions&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Timestamps&lt;br&gt;
Example:&lt;br&gt;
INITIATED → PROCESSING → PENDING → SUCCESS                       → FAILED → REVERSED&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log&lt;br&gt;
Logs save you in disputes, audits, and lawsuits.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Final Mental Model (Keep This Forever)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never trust the first response&lt;/li&gt;
&lt;li&gt;  Money systems are eventually consistent&lt;/li&gt;
&lt;li&gt;  Status is truth, not response codes&lt;/li&gt;
&lt;li&gt;  Accounting always wins
If you build fintech with this mindset, you won’t just pass tests you’ll survive production.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>fintech</category>
      <category>systemdesign</category>
      <category>backenddevelopment</category>
      <category>software</category>
    </item>
  </channel>
</rss>
