<?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: Hemanth Reddy</title>
    <description>The latest articles on DEV Community by Hemanth Reddy (@hemanth_reddy_koduru).</description>
    <link>https://dev.to/hemanth_reddy_koduru</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%2F3972797%2Ffd611615-c8e6-4b77-9af1-853a0fae0b55.jpg</url>
      <title>DEV Community: Hemanth Reddy</title>
      <link>https://dev.to/hemanth_reddy_koduru</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hemanth_reddy_koduru"/>
    <language>en</language>
    <item>
      <title>Bringing Razorpay to InsForge: Building a Production-Grade Payment Flow</title>
      <dc:creator>Hemanth Reddy</dc:creator>
      <pubDate>Sun, 07 Jun 2026 17:00:32 +0000</pubDate>
      <link>https://dev.to/hemanth_reddy_koduru/bringing-razorpay-to-insforge-building-a-production-grade-payment-flow-n9o</link>
      <guid>https://dev.to/hemanth_reddy_koduru/bringing-razorpay-to-insforge-building-a-production-grade-payment-flow-n9o</guid>
      <description>&lt;p&gt;If you're building a SaaS in India, Stripe isn't always an option. Razorpay is the standard. A few days ago I noticed that InsForge — a Y Combinator-backed open-source framework — had solid Stripe support but no Razorpay integration at all. For any developer targeting the Indian market, that's a hard blocker.&lt;br&gt;
So I decided to fix it. Three pull requests, ~3,000 lines of code, one week.&lt;/p&gt;

&lt;p&gt;Why Razorpay, and Where the Friction Actually Lives&lt;br&gt;
Razorpay gives you the same core primitives as Stripe: hosted checkouts, subscription billing, webhook events. The API calls themselves are straightforward.&lt;br&gt;
The friction isn't in the calls. It's in everything around them:&lt;/p&gt;

&lt;p&gt;Environment setup — safely isolating test and live keys&lt;br&gt;
Catalog management — syncing products and prices so your database matches the provider&lt;br&gt;
Webhook plumbing — HMAC signature verification, retry safety, event deduplication&lt;br&gt;
Fulfillment correctness — guaranteeing a user is never double-charged, even when requests drop and retry&lt;/p&gt;

&lt;p&gt;My goal was to abstract that friction away so developers using InsForge could wire up a Razorpay flow just as easily as a Stripe one.&lt;/p&gt;

&lt;p&gt;How I Broke It Down&lt;br&gt;
PR #1382 — The Foundation&lt;br&gt;
A payment provider integration isn't just a wrapper around API calls. It needs a provider abstraction layer that sits cleanly alongside Stripe without touching it, corrupting its data, or entangling its logic.&lt;br&gt;
I built sync services for products, plans, customers, subscriptions, and payments. Provider-aware database migrations. A dashboard UI that adapts its credential management depending on which provider is active.&lt;br&gt;
Scope expanded fast. What I thought would be a week of straightforward work turned out to be a careful architectural exercise in not breaking anything that already existed.&lt;/p&gt;

&lt;p&gt;PR #1485 — Webhook Infrastructure&lt;br&gt;
Payments don't happen in request/response cycles. A subscription renewal, a failed charge, a refund — all of it arrives asynchronously through webhooks. You have to build for that from the start or you're patching forever.&lt;br&gt;
I built idempotent event handlers and a secure, native secret-management system inside InsForge for generating and validating webhook secrets locally.&lt;br&gt;
Originally I designed this with automatic webhook endpoint registration via the Razorpay API. Then I actually read the API documentation carefully and found that programmatic webhook creation is restricted to Partner accounts. The whole approach had to go.&lt;br&gt;
I rebuilt around guided manual setup with automated validation instead. The constraint turned out to force a cleaner design.&lt;/p&gt;

&lt;p&gt;PR #1490 — Runtime Payment Flow&lt;br&gt;
The last gap: developers couldn't actually create Razorpay orders or subscriptions through InsForge the way they could with Stripe. The sync infrastructure was there, but the runtime flow wasn't.&lt;br&gt;
I built a RazorpayCheckoutService to handle checkout generation with strict idempotency guarantees:&lt;/p&gt;

&lt;p&gt;PostgreSQL Advisory Locking — handles concurrent requests safely at the database level&lt;br&gt;
Pre-flight Insertion with ON CONFLICT DO NOTHING — if a checkout request fails and retries, it returns the existing session rather than creating a duplicate charge&lt;br&gt;
Row-Level Security Migrations — precise RLS policies to keep payment attempt records isolated per provider&lt;/p&gt;

&lt;p&gt;The Part That Actually Taught Me Something&lt;br&gt;
Writing the code was the easy part.&lt;br&gt;
The harder part came during code review — with the maintainers and with InsForge's automated AI reviewers (cubic-dev-ai, greptile). These are strict. They caught edge cases I hadn't considered.&lt;br&gt;
The one that stuck with me: if an order fails and the frontend sends an idempotent retry, should the server return a silent success or a 409 Conflict? I had it wrong. The correct behavior is 409 — so the client knows the original attempt failed and can surface that to the user, rather than silently proceeding as if everything worked.&lt;br&gt;
The review questions I kept getting pushed on:&lt;/p&gt;

&lt;p&gt;What happens when a webhook fires twice simultaneously?&lt;br&gt;
Can two providers share a database without corrupting each other's data?&lt;br&gt;
What does this look like under concurrent load in six months when nobody who built it is around?&lt;/p&gt;

&lt;p&gt;I didn't have clean answers to all of these at first. Working through them was the real education.&lt;/p&gt;

&lt;p&gt;The Integration Is Live&lt;br&gt;
The Razorpay integration is merged into InsForge. If you're building a SaaS in India, you can now use InsForge's agentic workflow to wire up a production-ready Razorpay checkout — orders, subscriptions, webhooks, and all the reliability infrastructure underneath.&lt;br&gt;
The core PRs if you want to dig into the implementation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/InsForge/InsForge/pull/1382" rel="noopener noreferrer"&gt;PR #1382 — Foundational Provider &amp;amp; Sync&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/InsForge/InsForge/pull/1485" rel="noopener noreferrer"&gt;PR #1485 — Webhook Infrastructure&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/InsForge/InsForge/pull/1490" rel="noopener noreferrer"&gt;PR #1490 — Runtime Payment Flow&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks to the InsForge maintainers for the patience and the detailed architecture discussions. That kind of review from people who've shipped real production systems is hard to come by.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
