<?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: SysArch</title>
    <description>The latest articles on DEV Community by SysArch (@sys_arch_f39724a5ef2).</description>
    <link>https://dev.to/sys_arch_f39724a5ef2</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4259680%2Fca80e555-cea7-4267-949c-6deaa95cd270.png</url>
      <title>DEV Community: SysArch</title>
      <link>https://dev.to/sys_arch_f39724a5ef2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sys_arch_f39724a5ef2"/>
    <language>en</language>
    <item>
      <title>One Double-Click Charged My Customer Twice. So I Built a Payment Gateway That Can't.</title>
      <dc:creator>SysArch</dc:creator>
      <pubDate>Tue, 24 Nov 2026 13:44:17 +0000</pubDate>
      <link>https://dev.to/sys_arch_f39724a5ef2/one-double-click-charged-my-customer-twice-so-i-built-a-payment-gateway-that-cant-1fah</link>
      <guid>https://dev.to/sys_arch_f39724a5ef2/one-double-click-charged-my-customer-twice-so-i-built-a-payment-gateway-that-cant-1fah</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9c3rvx2oaipasimel1m0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9c3rvx2oaipasimel1m0.png" alt=" " width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2:47 AM. Sale day.&lt;br&gt;
One customer clicks Pay for a ₹2,499 laptop. Internet drops for two seconds. Spinner freezes. She clicks Pay again.&lt;/p&gt;

&lt;p&gt;You just charged her twice.&lt;br&gt;
In a normal app, that is a bug. You reload and forget it.&lt;br&gt;
In a payment gateway, that double-click is a race condition, a lost webhook, a corrupted ledger. Money just vanished.&lt;/p&gt;

&lt;p&gt;That is the moment I realised: a payment gateway is not just an API. It is financial infrastructure.&lt;/p&gt;

&lt;p&gt;Watch the full 25-minute build here:&amp;nbsp;&lt;br&gt;
  &lt;iframe src="https://www.youtube.com/embed/IiXPMURA2O8" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Why your normal backend breaks&amp;nbsp;here&lt;/p&gt;

&lt;p&gt;Most tutorials show this: Client to Server to Database. Update balance. Done.&lt;/p&gt;

&lt;p&gt;That works for a to-do app. It dies for payments.&lt;br&gt;
-&amp;gt; What if the bank processes the payment, but your server never gets the response?&lt;br&gt;
-&amp;gt; What if two threads try to capture the same payment at the same time?&lt;br&gt;
-&amp;gt; What if your webhook fails, and you retry the capture instead of the webhook?&lt;br&gt;
-&amp;gt; One wrong retry, and you have duplicate charges, missing ledger entries, or wrong merchant payouts.&lt;br&gt;
-&amp;gt; Real gateways like Razorpay and Stripe do not just update a database. -&amp;gt; They run on idempotency keys, immutable double-entry ledgers, transactional outbox, and reconciliation engines.&lt;/p&gt;

&lt;p&gt;I do not explain all of that in this article. I built it visually, step by step, in the video.&lt;/p&gt;

&lt;p&gt;What you will see in the&amp;nbsp;video&lt;/p&gt;

&lt;p&gt;In 25 minutes, we design a production-grade payment gateway from scratch, using one ₹2,499 transaction as the thread:&lt;/p&gt;

&lt;p&gt;-&amp;gt; How to handle 10 million payments a day, and a 10,000 TPS burst&lt;br&gt;
-&amp;gt; The master architecture: order, payment, orchestrator, risk, vault, adapters&lt;br&gt;
-&amp;gt; How idempotency actually stops the double charge, with database constraints&lt;br&gt;
-&amp;gt; The difference between FAILED and UNKNOWN, and why it saves you money&lt;br&gt;
The double-entry ledger, settlement calculation, and payout&lt;br&gt;
-&amp;gt; What to do when the bank times out, and how Saga and circuit breakers save you&lt;br&gt;
-&amp;gt; How it runs in production: scaling, security, observability&lt;/p&gt;

&lt;p&gt;One last&amp;nbsp;thing&lt;/p&gt;

&lt;p&gt;If this article made you think differently about that Pay button, the video will change how you design backends.&lt;/p&gt;

&lt;p&gt;Like, share, and subscribe to Aayam on YouTube. Next, we go inside card networks.&lt;br&gt;
  &lt;iframe src="https://www.youtube.com/embed/IiXPMURA2O8" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>systemdesign</category>
      <category>stripe</category>
      <category>paymentgateway</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
