Razorpay Stripe Billing

    by Zeeonix Digital

    1

    Implement production-grade dual-gateway billing with Razorpay, Stripe, and GST-compliant invoicing for Next.js.

    $14.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Razorpay Stripe Billing

    Example session with this skill installed

    Set up a dual-gateway billing system with Razorpay and Stripe for my Next.js app. I need webhook verification and GST invoice support.

    • Read your context and instructions
    • Compiled the razorpay stripe billing

    I have implemented the dual-gateway billing system. This includes the Prisma schema for orders and invoices, the checkout routing logic, and secure webhook handlers for both Razorpay and Stripe.

    Billing System Implementation

    1. Database Schema (Prisma)

    model PaymentOrder {
      id              String   @id @default(cuid())
      userId          String
      amount          Int      // In smallest unit (paise/cents)
      currency        String
      status          String   // PENDING, COMPLETED, FAILED
      provider        String   // RAZORPAY | STRIPE
      providerOrderId String   @unique
      createdAt       DateTime @default(now())
      Invoice         Invoice?
    }
    
    model WebhookEvent {
      id              String   @id @default(cuid())
      provider        String
      providerEventId String   @unique // Prevents double-processing
      processedAt     DateTime @default(now())
    }
    
    model Invoice {
      id             String       @id @default(cuid())
      orderId        String       @unique
      order          PaymentOrder @relation(fields: [orderId], references: [id])
      invoiceNumber  String       @unique // INV-2024-XXXX
      taxBreakdown   Json         // { cgst, sgst, igst, vat }
      totalAmount    Int
    }
    

    2. Webhook Verification (Node.js)

    import crypto from "crypto";
    
    // Razorpay HMAC Verification Example
    const expectedSignature = req.headers["x-razorpay-signature"];
    const body = await req.text();
    const generatedSignature = crypto
      .createHmac("sha256", process.env.RAZORPAY_WEBHOOK_SECRET!)
      .update(body)
      .digest("hex");
    
    if (!crypto.timingSafeEqual(Buffer.from(generatedSignature), Buffer.from(expectedSignature))) {
      return new Response("Invalid signature", { status: 400 });
    }
    

    Next steps

    • Add the provider secrets to your .env file.
    • Run npx prisma db push to sync the new payment and invoice models.
    • Configure your Razorpay and Stripe dashboards to point to the new /api/billing/webhooks endpoints.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Integrating global payments usually involves high risk and repetitive boilerplate. This skill implements a production-ready billing layer that handles both Razorpay for Indian markets and Stripe for global customers. It prevents double-charging and ensures tax compliance without manual logic.

    What it does

    • Dual-gateway routing automatically directs users to Razorpay for INR/UPI or Stripe for USD/EUR based on currency.
    • Cryptographic verification secures webhooks using HMAC and native SDK methods to prevent tampered payment signals.
    • Idempotent processing uses database constraints to safely handle webhook retries without double-crediting accounts.
    • Tax-compliant invoicing calculates CGST, SGST, IGST for Indian transactions and zero-rated VAT for international exports.
    • Server-side price enforcement ignores client-side amount inputs, fetching plan costs strictly from your database or config.

    How it works

    1. Initialize environment by installing SDKs and generating a secure .env.example template for both providers.
    2. Sync database models using the provided Prisma schema for orders, webhook event tracking, and invoices.
    3. Configure checkout API to authenticate sessions and route orders to the correct gateway based on the user's currency.
    4. Implement webhook listeners that verify signatures and execute database transactions for payment fulfillment.
    5. Generate invoices with sequential numbering and specific tax breakdowns for India and international regions.

    Frameworks & tools

    Built for Next.js App Router and Node.js. Uses Prisma for database operations, Zod for schema validation, and official stripe and razorpay SDKs.

    Why this beats prompting it yourself

    Writing billing logic from scratch often leads to security holes like price manipulation or race conditions during webhook processing. This skill provides a tested architecture for idempotency and specific Indian GST logic that generic prompts usually miss.

    Use cases

    • Launching a SaaS that needs UPI/Netbanking in India and cards globally.
    • Adding automated GST-compliant PDF invoicing to an existing agency platform.
    • Migrating from a single-gateway setup to a multi-currency billing system.
    • Hardening existing payment endpoints against webhook spoofing and double-processing.

    Known limitations

    Requires a database with unique constraint support for idempotency. Does not include frontend UI components for the checkout buttons.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 9 days ago

    Software
    tscNode.jstypescriptprisma

    Permissions

    Read Files
    Network Access
    Terminal / Shell
    Write Files
    Listed9 days ago

    What's inside

    Frequently Asked Questions

    This skill provides a pre-architected backend billing layer for Next.js that manages both Razorpay (for India) and Stripe (globally), handling complex logic like GST compliance and webhook security that standard AI prompts often overlook.

    The skill provides a complete backend implementation including a Prisma schema for transaction tracking, API routes for secure checkouts, and specialized webhook handlers designed to prevent double-charging.

    Yes, the skill includes specialized logic for Indian GST (CGST, SGST, IGST) and provides the necessary structure to generate zero-rated VAT invoices for international exports.

    It is optimized for the Next.js App Router and Node.js environments using Prisma ORM; it requires a database that supports unique constraints to ensure payment idempotency.

    While it provides the full backend logic and API infrastructure for routing payments, you will still need to create your own frontend buttons or checkout UI to trigger the provided functions.

    The skill uses HMAC cryptographic verification and native SDK methods to ensure that payment signals are legitimate and have not been tampered with by external actors.

    New in APIs & Backend

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.