Skip to content

feat(payments): implement Razorpay gateway support (#960) - #1321

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
livinalt:feat/960-implement-razorpay-gateway-support
Oct 21, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
livinalt:feat/960-implement-razorpay-gateway-support

Conversation

@livinalt

Copy link
Copy Markdown
Contributor

What this PR does

  • Implements the complete Razorpay payment gateway integration for the AgenticPay platform (Implement Razorpay gateway support #960).
  • Adds a dedicated RazorpayClient for interacting with the Razorpay API, supporting payment creation, payment retrieval, refunds, and webhook signature verification.
  • Adds RazorpayGatewayAdapter, extending BaseGatewayAdapter with circuit-breaker protection, latency tracking, and health monitoring.
  • Introduces RazorpayPaymentProvider implementing the PaymentProvider interface for integration with the payment provider registry.
  • Updates payment routing to support Razorpay as a payment provider.
  • Registers Razorpay during payment provider bootstrap.
  • Adds REST API endpoints under /api/v1/razorpay for payment operations and webhook handling.
  • Includes comprehensive unit and integration tests for the Razorpay client, provider, gateway adapter, and routing logic.
  • Breaking changes: None.
  • Migrations: None required.

Changes

New Files

  • backend/src/integrations/razorpay/types.ts

    • TypeScript interfaces for Razorpay payments, orders, refunds, webhooks, and configuration.
  • backend/src/integrations/razorpay/razorpay-client.ts

    • Razorpay API client responsible for API communication, authentication, webhook verification, and sandbox support.
  • backend/src/integrations/razorpay/gateway-adapter.ts

    • RazorpayGatewayAdapter implementation extending BaseGatewayAdapter.
  • backend/src/integrations/razorpay/index.ts

    • Barrel exports for the Razorpay integration.
  • backend/src/integrations/razorpay/__tests__/razorpay.test.ts

    • Unit tests covering the Razorpay client and gateway adapter.
  • backend/src/routes/razorpay.ts

    • REST API routes for payment creation, payment retrieval, refunds, and webhook processing.
  • backend/src/services/payments/providers/razorpay.ts

    • Razorpay implementation of the PaymentProvider interface.
  • backend/src/services/payments/__tests__/razorpay-provider.test.ts

    • Integration tests covering provider execution and payment routing.

Updated Components

  • backend/src/integrations/gateway-adapter.ts

    • Extended the gateway adapter to support Razorpay.
  • backend/src/services/payments/bootstrap.ts

    • Registered the RazorpayPaymentProvider during application startup.
  • backend/src/services/payments/payment-router.ts

    • Updated payment routing to support Razorpay.
  • backend/src/index.ts

    • Mounted the Razorpay router under /api/v1/razorpay.
  • backend/src/config/env.js

    • Added Razorpay environment configuration and test defaults.
  • backend/src/services/whatsapp-payment-notifications.ts

    • Updated WhatsApp payment notification handling to support Razorpay payment events.
  • backend/src/services/__tests__/whatsapp-notifications.test.ts

    • Extended notification test coverage for Razorpay payment notifications.

Why

This PR implements the Razorpay payment gateway integration requested in Issue #960, enabling AgenticPay to process payments through Razorpay while integrating seamlessly with the existing payment provider registry and gateway abstraction layer. The implementation includes secure webhook verification, gateway health monitoring, provider-based routing, and comprehensive automated testing while remaining fully backward compatible with existing payment providers.


How to test

  1. Run the Razorpay client and gateway adapter tests:
npx --no-install vitest run backend/src/integrations/razorpay/__tests__/razorpay.test.ts
  1. Run the Razorpay payment provider tests:
npx --no-install vitest run backend/src/services/payments/__tests__/razorpay-provider.test.ts
  1. (Optional) Configure the following environment variables for live Razorpay integration:
  • RAZORPAY_KEY_ID
  • RAZORPAY_KEY_SECRET
  • RAZORPAY_WEBHOOK_SECRET
  1. Test the REST API endpoints:
  • POST /api/v1/razorpay/payments
  • GET /api/v1/razorpay/payments/:id
  • POST /api/v1/razorpay/refunds
  • POST /api/v1/razorpay/webhook

Notes

  • The implementation supports sandbox/testing workflows when production credentials are unavailable.
  • Webhook signature verification follows Razorpay's recommended HMAC validation process.
  • Existing payment providers remain unaffected.
  • Closes Implement Razorpay gateway support #960

@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown

@livinalt is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@livinalt Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@github-actions
github-actions Bot merged commit f91fac2 into Smartdevs17:main Oct 21, 2026
16 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Razorpay gateway support

1 participant