CommentGate helps WordPress site owners monetize engagement by requiring visitors to complete Stripe or PayPal payment before commenting on selected posts, pages, or public custom post types.
- Pay Before Commenting - Hide the normal comment fields until payment access is verified.
- Comment Quantity Access - Sell 1, 2, or custom comment credits per purchase.
- Duration Access - Unlock commenting for a set number of minutes, with
0for no expiry. - Per-Content Overrides - Override payment requirement, price, access type, and comment quantity per post, page, or custom post type.
- Role Exemptions - Let selected WordPress roles comment without payment.
- Stripe Checkout - Redirect visitors to Stripe-hosted checkout.
- PayPal Checkout - Redirect visitors to PayPal approval checkout.
- Enable One Or Both Gateways - Show Stripe, PayPal, or both buttons on the frontend payment wall.
- Webhook Support - Confirm payments and refunds through gateway webhooks.
- General Settings - Enable paid comments, choose post types, set pricing, configure access type, and manage moderation.
- Transaction History - View payments, earning summaries, filters, CSV export, pagination, refunds, pending actions, and delete actions.
- Payment API Configuration - Add Stripe or PayPal credentials and review setup checks.
- Email Settings - Configure admin alerts, customer receipts, refund emails, templates, logo, footer, and previews.
- Appearance - Customize Stripe/PayPal button text and optional custom button colors.
- Customer Receipts - Send payment-complete and refund emails through WordPress mail.
- HTML Invoice Or Simple Text-Style Email - Choose format from admin settings.
- Media Library Logo - Add optional logo to HTML invoice emails.
- Secure Access Links - Customers can reopen paid comment area until credits are used or access expires.
- Admin Alerts - Notify the site administrator when payment completes.
- Unused Access Refunds - Refund payments only when paid access has not been used.
- Stripe And PayPal API Refunds - Refund from WordPress admin when gateway data is available.
- Refund Audit Fields - Store refund ID, reason, and refund date when available.
- Earning Summaries - See total paid earnings, pending value, transaction counts, and remaining comment credits.
- CSV Export - Export filtered transaction history.
- WordPress 6.0 or higher
- PHP 7.4 or higher
- Stripe account or PayPal developer account
- HTTPS site for live payments
-
Download or clone this repository
git clone https://github.com/dhruvpandyadp/commentgate.git
-
Install the plugin
Copy the commentgate folder to wp-content/plugins/ -
Activate in WordPress
WordPress Admin -> Plugins -> CommentGate -> Activate -
Open settings
Comments -> CommentGate -
Configure paid comment access
- Enable paid comments.
- Choose supported post types.
- Set price and currency.
- Select comment quantity or duration access.
- Enable Stripe, PayPal, or both.
-
Add payment credentials
- Open Payment API Configuration.
- Add Stripe and/or PayPal API credentials.
- Configure webhook URLs shown in settings.
-
Run a sandbox payment
- Use Stripe test mode or PayPal sandbox first.
- Confirm transaction changes from pending to paid.
- Confirm comment form unlocks after payment.
| Tab | Purpose |
|---|---|
| General Settings | Enable paid comments, post types, gateways, price, roles, access type, duration, and comment quantity |
| Transaction History | View earnings, filter payments, export CSV, refund unused access, and manage records |
| Payment API Configuration | Store Stripe/PayPal credentials, webhook details, and setup checklist |
| Email Settings | Configure admin emails, customer emails, templates, logo, footer, and previews |
| Appearance | Customize button labels and optional custom colors |
| Step | Visitor Experience |
|---|---|
| 1 | Visitor opens protected content |
| 2 | Comment form is locked behind payment wall |
| 3 | Visitor enters email address for receipt/access |
| 4 | Visitor clicks Pay with Stripe to Comment or Pay with PayPal to Comment |
| 5 | Gateway checkout opens |
| 6 | After payment, visitor returns to content |
| 7 | Comment form unlocks until credits are used or access expires |
Example: 1 comment credit
Visitor pays once and can submit 1 comment.
After credit is used, another payment is required.
Example: 15 minutes
Visitor pays once and can comment during the access window.
Use 0 minutes for no expiry.
- Add Stripe secret key.
- Add Stripe webhook secret.
- Configure webhook URL from the settings page.
- Send these events:
checkout.session.completedcharge.refundedcheckout.session.async_payment_failed
Official docs: Stripe API Keys
- Add PayPal client ID.
- Add PayPal secret.
- Choose sandbox or live mode.
- Configure webhook URL from the settings page.
- Send this event:
PAYMENT.CAPTURE.REFUNDED
Official docs: PayPal REST API Credentials
CommentGate registers wp commentgate when WP-CLI is available.
wp commentgate status
wp commentgate settings
wp commentgate settings --show-secrets --format=json
wp commentgate payments --status=paid
wp commentgate payments --gateway=stripe --format=csv
wp commentgate payment 123
wp commentgate refund 123 --yes- WordPress Plugin API - Admin menus, settings, comments, hooks, REST routes, and mail.
- Stripe Checkout API - Hosted checkout, payment confirmation, and refunds.
- PayPal Checkout API - Order creation, capture, webhook verification, and refunds.
- WP-CLI - Command-line inspection and refund tools.
- WordPress Mail - Admin alerts and customer emails through the site mail system.
commentgate/
commentgate.php
readme.txt
README.md
includes/
class-commentgate-admin-payments.php
class-commentgate-cli.php
class-commentgate-comment-gate.php
class-commentgate-payments-table.php
class-commentgate-paypal-gateway.php
class-commentgate-plugin.php
class-commentgate-settings.php
class-commentgate-stripe-gateway.php
class-commentgate-webhooks.php
templates/
payment-box.php
assets/
css/
admin.css
frontend.css
js/
admin.js
frontend.js
languages/
index.php
CommentGate connects to third-party payment services only when a gateway is configured and a visitor starts checkout, returns from checkout, an administrator starts a refund, or a configured webhook is received.
| Service | Endpoint | Purpose |
|---|---|---|
| Stripe | https://api.stripe.com |
Checkout sessions, refunds, webhook payment status |
| PayPal Sandbox | https://api-m.sandbox.paypal.com |
Sandbox orders, captures, refunds, webhook verification |
| PayPal Live | https://api-m.paypal.com |
Live orders, captures, refunds, webhook verification |
Data sent to gateways can include post title, amount, currency, plugin payment ID, access type, comment quantity, gateway payment IDs, capture IDs, and guest email when entered.
Comment quantity access:
Refund allowed when all purchased comment credits remain unused.
Duration access:
Refund allowed when CommentGate has not attached the payment to a submitted comment.
Refunds call the configured Stripe or PayPal API first, then mark the payment record as refunded inside WordPress.
CommentGate sends email through the normal WordPress mail system and adds site From and Reply-To headers. For best inbox placement, configure authenticated SMTP plus SPF, DKIM, and DMARC for the sending domain.
Scenario: Site owner wants paid access to high-value comment threads
Action: Enable CommentGate for selected posts
Result: Visitors pay before joining discussion
Benefit: Monetized engagement without locking full content
Scenario: Expert publishes posts and charges per question/comment
Action: Use comment quantity based access with 1 comment per purchase
Result: Each paid visitor gets one verified comment credit
Benefit: Simple paid Q&A workflow
Scenario: Admin wants fewer low-quality comments
Action: Require small payment before comment form unlocks
Result: Spam and drive-by comments decrease
Benefit: Cleaner discussion and stronger intent
- Use sandbox/test credentials before enabling live payments.
- Configure webhooks so pending payments update correctly.
- Live payments should run on HTTPS.
- CommentGate controls paid access to comment forms; WordPress Discussion Settings still control site-wide comment rules.
- Email deliverability depends on site mail configuration and domain DNS records.
| Field | Value |
|---|---|
| Contributors | dhruvpandya |
| Requires at least | 6.0 |
| Tested up to | 7.0 |
| Requires PHP | 7.4 |
| Stable tag | 1.0.0 |
| License | GPL-2.0-or-later |
| Text Domain | commentgate |
Support CommentGate development:
https://www.paypal.com/paypalme/dhruvpandyadp97
This project is licensed under the GPL-2.0-or-later license.
Created by Dhruv Pandya
- Website: https://pandyadhruv.com
- Linkedin: https://www.linkedin.com/in/dhruvpandyadp/
Install CommentGate, connect Stripe or PayPal, run a sandbox payment, and turn selected comment forms into paid discussion spaces.