Razorpay for FluentCart
Razorpay gateway for fluentcart
by FluentCart · github.com/wpmanageninja/razorpay-for-fluent-cart · website
Install
The author publishes release zips, so WP-CLI can install straight from GitHub:
wp plugin install https://github.com/wpmanageninja/razorpay-for-fluent-cart/releases/download/1.2.1/razorpay-for-fluent-cart.zipReadme
Razorpay for FluentCart
A WordPress plugin that integrates Razorpay payment gateway with FluentCart.
Features
- ✅ One-time payments
- ✅ Modal checkout (popup)
- ✅ Hosted checkout (redirect)
- ✅ Webhook integration
- ✅ Refund processing via API
- ✅ Test and Live modes
- ✅ INR currency support
- ✅ Multiple payment methods (Cards, UPI, Netbanking, Wallets)
- ⚠️ No subscription support (Razorpay limitation in this implementation)
Installation
Prerequisites
- WordPress 5.6 or higher
- PHP 7.4 or higher
- FluentCart plugin installed and activated
- A Razorpay merchant account
Install & Activate
-
Download the Plugin
- Visit the latest release
- Download the
Source code (zip)file
-
Upload to WordPress
- Go to your WordPress admin dashboard
- Navigate to Plugins > Add New
- Click Upload Plugin
- Select the downloaded zip file and click Install Now
-
Activate the Plugin
- After installation, click Activate Plugin
- Alternatively, go to Plugins and click "Activate" below the plugin name
-
Configure Razorpay
- Go to FluentCart > Settings > Payment Methods
- Find and enable Razorpay
- Enter your Test and Live API keys from the Razorpay Dashboard
- Configure your webhook URL (see Configuration below)
Updates
To update the Razorpay for FluentCart addon:
-
Check for Updates
- Go to FluentCart > Settings > Payment Methods
- Click on the Razorpay payment method
- Click the Check for Updates button
-
Download the New Version
- If a new version is available, an Update Now button will appear
- Clicking this button will take you to the latest release page
- Download the
Source code (zip)file
-
Install the Update
- Go to Plugins > Add New > Upload Plugin
- Upload the new zip file
- WordPress will automatically replace the old version with the new one
- Reactivate the plugin if prompted
Note: Since this addon is distributed via GitHub releases (not the WordPress Plugin Directory), updates must be installed manually using the steps above.
Requirements
- WordPress 5.6 or higher
- PHP 7.4 or higher
- FluentCart plugin (free or pro version)
- Razorpay merchant account
Configuration
Getting Credentials
- Log into your Razorpay Dashboard
- Navigate to Settings > API Keys
- Copy your Key ID (Public Key) and Key Secret (Secret Key)
Setting Up Webhooks
- Go to Settings > Webhooks in Razorpay Dashboard
- Add webhook URL:
https://yourdomain.com/?fluent-cart=fct_payment_listener_ipn&method=razorpay - Select events to listen for (recommended: payment events)
Checkout Types
- Modal Checkout: Opens Razorpay payment popup on your site
- Hosted Checkout: Redirects customer to Razorpay payment page
Development
Directory Structure
razorpay-for-fluent-cart/
├── razorpay-for-fluent-cart.php # Main plugin file
├── assets/
│ ├── razorpay-checkout.js # Frontend payment handler
│ └── images/
│ └── razorpay-logo.svg # Payment method logo
├── includes/
│ ├── RazorpayGateway.php # Main gateway class
│ ├── API/
│ │ └── RazorpayAPI.php # API client
│ ├── Webhook/
│ │ └── RazorpayWebhook.php # Webhook handler
│ ├── Onetime/
│ │ └── RazorpayProcessor.php # Payment processor
│ ├── Settings/
│ │ └── RazorpaySettingsBase.php # Settings management
│ └── Confirmations/
│ └── RazorpayConfirmations.php # Payment confirmations
└── README.md
API Endpoints
- Base URL:
https://api.razorpay.com/v1 - Create Order:
POST /orders - Get Payment:
GET /payments/{payment_id} - Create Payment Link:
POST /payment_links - Create Refund:
POST /payments/{payment_id}/refund
Hooks and Filters
Filters
razorpay_fc/payment_link_args- Modify payment link arguments before sending to Razorpayrazorpay_fc/razorpay_settings- Modify Razorpay settings
Payment Flow
- Customer initiates checkout → FluentCart collects order info
- FluentCart calls
makePaymentFromPaymentInstance() - RazorpayProcessor creates Razorpay order (for modal) or payment link (for hosted)
- Modal: Opens Razorpay checkout popup
- Hosted: Redirects to Razorpay payment page
- Customer pays using preferred method
- Razorpay webhook notifies your site
- RazorpayWebhook verifies and processes payment
- FluentCart completes the order
Testing
Test Mode
- Enable Test Mode in settings
- Use test Key ID and Key Secret from Razorpay
- Use test cards provided by Razorpay
Test Cards
See Razorpay documentation for test card numbers: https://razorpay.com/docs/payments/test-cards/
Webhook Testing
- Complete a test payment
- Check FluentCart logs for webhook reception
- Verify transaction status is updated
- Confirm order status changes to "paid"
Important Notes
Currency Requirements
- Primary currency should be INR (Indian Rupee)
- Amounts should be in paise (smallest currency unit)
- Example: ₹100.00 = 10000 paise
Refunds
Razorpay supports automated refunds via API. Use the refund feature in FluentCart admin to process refunds.
Subscriptions
This plugin currently only supports one-time payments. Subscription support may be added in future versions.
Troubleshooting
Common Issues
-
Payment initialization fails
- Check Key ID and Key Secret are correct
- Verify you're using correct mode (test/live)
- Check Razorpay account status
-
Webhook not received
- Verify your site is publicly accessible
- Check webhook URL is correct in Razorpay dashboard
- Test webhook using Razorpay dashboard tools
-
Modal not opening
- Check Razorpay checkout script is loaded
- Verify browser console for JavaScript errors
- Ensure Key ID is correctly set
Debug Logging
Add to wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
Check logs at wp-content/debug.log
Support
For issues, questions, or contributions:
- Razorpay API: https://razorpay.com/docs/
- FluentCart Documentation: https://fluentcart.com/docs/
License
GPLv2 or later. See LICENSE file for details.
Credits
Built for FluentCart following Razorpay API documentation.
Read the full README on GitHub →