WP Manifestindependent plugin directory
manifest / ecommerce / razorpay-donations-wordpress-plugin

Razorpay Donations

Razorpay Donations WordPress Plugin

by Roopam Paradkar · github.com/roopamparadkar/razorpay-donations-wordpress-plugin · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/roopamparadkar/razorpay-donations-wordpress-plugin/archive/refs/heads/main.zip

A secure WordPress plugin for accepting one-time and monthly donations using Razorpay payment gateway.

Features

  • Two Donation Types: One-time donations and monthly subscriptions
  • Flexible Amounts: Predefined amounts (₹1,000, ₹5,000, ₹10,000) and custom amount input
  • Special Support Option: "Support an Educator's Salary" for ₹30,000
  • Clean UI: Simple and elegant design using #2c7a2c color scheme
  • Secure Payments: Server-side order creation and payment verification
  • Responsive Design: Works on all devices
  • Admin Dashboard: Easy configuration and donation tracking

Installation

  1. Upload the razorpay-donations folder to your /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Go to Settings → Razorpay Donations to configure your API keys

Configuration

Getting Razorpay API Keys

  1. Sign up for a Razorpay account at https://dashboard.razorpay.com/
  2. Navigate to Settings → API Keys
  3. Generate new API keys or copy existing ones
  4. Use test keys for testing (rzptest) and live keys for production (rzplive)

Plugin Setup

  1. Go to WordPress Admin → Settings → Razorpay Donations
  2. Enter your Razorpay Key ID and Key Secret
  3. Enable/disable test mode as needed
  4. Save the settings

Usage

Add the donation form to any page or post using the shortcode:

[razorpay_donations]

How It Works

One-Time Donations

  • User selects "Donate Once"
  • Custom amount input field appears
  • User can enter any amount or select predefined amounts
  • Creates a Razorpay order and processes payment

Monthly Donations

  • User selects "Donate Monthly"
  • Other buttons are disabled except Pay button
  • Creates a Razorpay subscription plan and processes recurring payment

Security Features

  • ✅ Payment signature verification using HMAC SHA256
  • ✅ WordPress nonce protection for AJAX requests
  • ✅ Server-side order/subscription creation
  • ✅ Input sanitization and validation
  • ✅ Secure database storage of payment records
  • ✅ No sensitive data stored in browser

Database

The plugin creates a table wp_rzp_donations to store payment records:

  • id: Auto-increment primary key
  • payment_id: Razorpay payment ID
  • order_id: Razorpay order ID
  • amount: Payment amount
  • status: Payment status (completed, pending, failed)
  • created_at: Timestamp

File Structure

razorpay-donations/
├── razorpay-donations.php      # Main plugin file
├── admin/
│   └── settings.php            # Admin settings page
├── assets/
│   ├── css/
│   │   └── donations.css       # Styling
│   └── js/
│       └── donations.js        # Frontend JavaScript
├── templates/
│   └── donation-form.php       # Donation form template
└── README.md                   # This file

Customization

Colors

The plugin uses #2c7a2c as the primary color. You can customize this by editing the CSS file or adding custom CSS to your theme.

Amounts

To change the predefined amounts, edit the amounts in templates/donation-form.php:

<button type="button" class="rzp-amount-btn" data-amount="1000">₹1,000</button>
<button type="button" class="rzp-amount-btn" data-amount="5000">₹5,000</button>
<button type="button" class="rzp-amount-btn" data-amount="10000">₹10,000</button>

Educator Support Amount

To change the educator support amount, edit the amount in the template:

<button type="button" class="rzp-educator-btn" data-amount="30000">
    Support an Educator's Salary
    <span class="rzp-educator-amount">₹30,000</span>
</button>

Hooks and Filters

Actions

  • rzp_donation_completed: Fired when a payment is successfully completed
  • rzp_subscription_created: Fired when a subscription is successfully created

Filters

  • rzp_donation_form_args: Filter donation form arguments
  • rzp_order_data: Filter order data before sending to Razorpay
  • rzp_subscription_data: Filter subscription data before sending to Razorpay

Troubleshooting

Common Issues

  1. Payment not working: Check your API keys and ensure they're correct
  2. Test mode: Make sure test mode setting matches your API keys
  3. JavaScript errors: Check browser console for errors
  4. Database errors: Ensure WordPress has proper database permissions

Debug Mode

Add this to your wp-config.php to enable debug logging:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);

Support

For support and customization requests, please contact the plugin developer or create an issue in the plugin repository.

Changelog

Version 1.0.0

  • Initial release
  • One-time and monthly donations
  • Razorpay integration
  • Admin settings panel
  • Responsive design
  • Security features

License

This plugin is licensed under the GPL v2 or later.

Requirements

  • WordPress 5.0 or higher
  • PHP 7.4 or higher
  • SSL certificate (required for live payments)
  • Razorpay account and API keys