A production-ready Razorpay payment gateway integration for WHMCS, enabling Indian merchants to accept credit cards, debit cards, netbanking, UPI, and wallet payments seamlessly.
- Multi-WHMCS Support – Compatible with WHMCS 6.x, 7.x, 8.x, and 9.x
- PHP 5.6+ Compatible – Graceful fallbacks for older PHP versions
- Webhook Processing – Automatic payment confirmation and recording
- Full & Partial Refunds – Process refunds directly from WHMCS
- Multi-Currency – Support for INR, USD, EUR, GBP, and more
- Gateway Fee Handling – Merchant absorbs or client pays options
- Secure – PCI compliant, offsite processing, signature verification
razorpay-whmcs/
├── modules/gateways/
│ ├── razorpay.php # Main gateway module
│ ├── callback/razorpay.php # Payment callback handler
│ └── razorpay/
│ ├── razorpay-webhook.php # Webhook processor
│ ├── rzpordermapping.php # Order mapping utility
│ ├── lib/razorpay-sdk/ # Official Razorpay PHP SDK
│ └── README.md # Module documentation
├── razorpay-whmcs-module/ # Distributable package
│ ├── CHANGELOG.md
│ ├── INSTALLATION.md
│ └── scripts/ # Utility & test scripts
├── AGENT.md # AI coding guidelines
└── .cursor/rules/ # Cursor AI rules
- WHMCS 6.0+ installed and running
- PHP 5.6+ with cURL extension
- SSL certificate (required for webhooks)
- Razorpay account with API keys
- Download the latest release or clone this repository
- Upload module files to your WHMCS installation:
cp modules/gateways/razorpay.php /path/to/whmcs/modules/gateways/ cp modules/gateways/callback/razorpay.php /path/to/whmcs/modules/gateways/callback/ cp -r modules/gateways/razorpay /path/to/whmcs/modules/gateways/
- Configure in WHMCS Admin → Setup → Payments → Payment Gateways
| Setting | Description |
|---|---|
| Key ID | Your Razorpay Key ID (Get keys) |
| Key Secret | Your Razorpay Key Secret |
| Webhook Secret | Secret for webhook signature verification |
| Enable Webhook | Must be Yes for payments to be recorded |
| Gateway Fee Mode | Merchant absorbs (default) or Client pays |
| Supported Currencies | Comma-separated list (e.g., INR,USD,EUR) |
⚠️ Without webhooks, payments will NOT be recorded in WHMCS!
- Go to Razorpay Dashboard → Settings → Webhooks
- Click Add New Webhook
- Enter URL:
https://yourdomain.com/modules/gateways/razorpay/razorpay-webhook.php - Select events:
- ✅
payment.captured - ✅
order.paid - ✅
refund.created - ✅
refund.processed
- ✅
- Copy the webhook secret to WHMCS gateway configuration
Use Razorpay test mode credentials and test cards:
| Card Number | Result |
|---|---|
4111 1111 1111 1111 |
Success |
4000 0000 0000 0002 |
Failure |
Verify in: WHMCS Admin → Utilities → Logs → Gateway Log
# Sync payments from Razorpay
php modules/gateways/razorpay/scripts/sync-payments.php --since=2025-01-01
# Webhook diagnostics
php modules/gateways/razorpay/scripts/webhook-diagnostic.php
# Cross-check payments
php modules/gateways/razorpay/scripts/cross-check-tool.php| Issue | Solution |
|---|---|
| Payments not recorded | Verify webhook is enabled and URL is correct |
| Signature verification failed | Check webhook secret matches in both places |
| Currency not supported | Add currency to supported currencies list |
For detailed troubleshooting, see INSTALLATION.md.
To surface Razorpay EMI² affordability information on product or cart pages:
- Enable Affordability Widget and set Affordability Widget Key in the Razorpay gateway settings.
- Ensure your active WHMCS theme includes a container where the widget should render, for example:
<div id="razorpay-affordability-widget"></div>- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Follow the coding rules in AGENT.md
- Test thoroughly with WHMCS test environment
- Submit a pull request
This project is licensed under the MIT License – see LICENSE for details.
- Issues: GitHub Issues
- Razorpay Support: integrations@razorpay.com
- Documentation: razorpay.com/docs
Version: 2.2.1 | Tested on: WHMCS 6.3, 7.10, 8.13 | PHP: 5.6, 7.4, 8.0, 8.1, 8.2