=== PostGate - Paywall & Content Monetization ===
Contributors: qodesphere
Tags: paywall, membership, stripe, subscription, paid-content
Requires at least: 6.2
Tested up to: 6.9
Stable tag: 1.0.3
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Complete WordPress paywall solution. Create flexible paywalls, sell content with purchases or subscriptions, and monetize via Stripe.

== Description ==

### The Complete WordPress Paywall Plugin

**PostGate** is the most flexible WordPress paywall plugin for content creators, publishers, and membership site owners. Whether you want to add a paywall to your entire site, specific categories, individual posts, or even blocks within posts, PostGate gives you complete control over your WordPress content monetization strategy.

### WordPress Content Monetization Made Simple

PostGate enables you to monetize premium content through flexible payment options. Gate content behind paywalls, sell one-time access to articles, create membership subscriptions, or mix payment models to maximize your revenue.

### Key Features

**Flexible Content Protection**
- **Site-Wide Locking**: Gate your entire website behind a paywall or login requirement
- **Post-Level Control**: Lock individual posts with custom pricing and access rules
- **Category-Based Access**: Apply payment requirements to entire categories or taxonomies
- **Block-Level Gating**: Lock specific sections within posts using the PostGate Lock Block
- **Granular Override System**: Post-level settings override category rules, which override global settings

**Multiple Monetization Options**
- **One-Time Purchases**: Sell individual articles or content pieces for single payments
- **Recurring Subscriptions**: Offer monthly, yearly, or custom subscription plans
- **Mixed Pricing Models**: Combine one-time and subscription options for the same content
- **Flexible Pricing**: Set different prices per post, category, or site-wide
- **Multiple Product Options**: Present users with various pricing tiers to choose from

**Take Complete Control of Content Access**
- **Protect free content**: Let only registered members access content without requiring payment
- **Monetize premium content**: Require payment or active subscriptions to unlock your best content
- **Grant VIP access**: Automatically give administrators, editors, or custom roles instant access
- **Seamless post-purchase experience**: Automatically unlock content after successful payment

**Professional Paywall Templates**
- **Compact Layout**: Streamlined design optimized for mobile devices and quick conversions
- **Classic Layout**: Traditional paywall with detailed pricing information and descriptions
- **Fully Customizable**: Override templates in your theme for complete design control
- **SEO-Friendly**: Preview content before the paywall for search engine crawlers

**Content Preview Options**
- **Paragraph Mode**: Show first N paragraphs as a teaser
- **Word Count Mode**: Display first N words with automatic truncation
- **Customizable Limits**: Set preview length per post or globally
- **Smart Truncation**: Intelligent content splitting that respects HTML structure

**Seamless Stripe Integration**
- **Stripe Connect**: Secure OAuth connection with your Stripe account
- **Live & Sandbox Modes**: Test your paywall before going live
- **Automatic Webhook Handling**: Real-time payment processing and access granting
- **Secure Checkout**: Users complete payments on Stripe-hosted checkout pages
- **Multiple Currencies**: Support for all Stripe-supported currencies

**Developer-Friendly Architecture**
- **Template System**: Override any template in your theme
- **REST API Endpoints**: Integrate with external applications
- **Action & Filter Hooks**: Extend functionality with custom code
- **Modern React Admin**: Intuitive settings interface built with React
- **Gutenberg Integration**: Native block editor support with custom blocks
- **Well-Documented Code**: Comprehensive inline documentation following WordPress standards

### Use Cases

- **Content Publishers**: Monetize premium articles, investigative journalism, or exclusive reports
- **Membership Sites**: Create tiered membership levels with subscription-based access
- **Online Courses**: Lock course modules and lessons behind payment gates
- **Digital Downloads**: Sell access to downloadable content like ebooks, templates, or resources
- **Professional Blogs**: Offer premium content alongside free articles
- **News Publications**: Implement metered paywalls or hard paywalls for news content
- **Tutorial Sites**: Gate advanced tutorials while keeping beginner content free
- **Research Platforms**: Monetize research papers, case studies, or whitepapers

### How It Works

1. **Connect Stripe**: Link your Stripe account using secure OAuth authentication
1. **Configure Settings**: Choose between site-wide locking, selective post types, or manual control
1. **Set Products**: Create and sync products from your Stripe dashboard
1. **Protect Content**: Apply paywall protection globally, by category, per post, or at block level
1. **Customize Appearance**: Choose paywall templates and customize preview settings
1. **Start Earning**: Users purchase access and are automatically granted content access

### Security & Privacy

PostGate is built with security best practices in mind:
- All payment processing handled by Stripe (PCI DSS compliant)
- Webhook signature verification prevents unauthorized access grants
- Nonce verification on all AJAX requests
- Sanitization and validation of all user inputs
- Role and capability checks throughout the plugin
- Secure OAuth flow for Stripe account connection

### Internationalization

PostGate is translation-ready and includes:
- WordPress.org translation compatibility
- Text domain: `postgate`
- RTL language support ready

### Dashboard & Analytics

- **Order Management**: View all purchases and subscriptions
- **Revenue Tracking**: Monitor your earnings over time
- **Access Grants Overview**: See which users have access to what content

### Customization Options

- **Paywall Appearance**: Customize badge, title, description, and button text
- **Login Gate Settings**: Configure login-specific messaging and registration links
- **Preview Control**: Fine-tune how much content appears before the paywall
- **Content Before/After Products**: Add custom HTML content around product options
- **Post-Purchase Behavior**: Choose where users land after completing a purchase

### What's New in Version 1.0.0

- Initial release with complete paywall functionality
- Stripe Connect integration with OAuth authentication
- One-time purchases and recurring subscriptions support
- Site-wide, category-level, post-level, and block-level content protection
- Two professional paywall templates (Compact and Classic)
- Comprehensive access management system
- Preview/teaser content with paragraph or word-based truncation
- Role-based bypass system
- React-based admin interface
- REST API for orders and dashboard analytics
- Comprehensive webhook handling for Stripe events
- Internationalization support

== Installation ==

### Automatic Installation

1. Log in to your WordPress admin dashboard
1. Navigate to **Plugins > Add New**
1. Search for "PostGate"
1. Click **Install Now** next to the PostGate plugin
1. After installation, click **Activate**
1. Go to **PostGate > Settings** to configure the plugin

### Manual Installation

1. Download the `postgate.zip` file
1. Log in to your WordPress admin dashboard
1. Navigate to **Plugins > Add New > Upload Plugin**
1. Click **Choose File** and select the downloaded `postgate.zip` file
1. Click **Install Now**
1. After installation, click **Activate Plugin**
1. Go to **PostGate > Settings** to configure the plugin

### Configuration

**Step 1: Connect Stripe Account**
1. Navigate to **PostGate > Settings > Payments**
1. Click **Connect with Stripe** button
1. Log in to your Stripe account (or create one if needed)
1. Authorize PostGate to access your Stripe account
1. You'll be redirected back to your WordPress site

**Step 2: Configure Webhook**
1. Copy the webhook URL from **PostGate > Settings > Payments**
1. Add this URL to your Stripe account webhook endpoints
1. Select all checkout and payment events
1. Copy the webhook signing secret back to PostGate settings
1. Save your settings

**Step 3: Sync Stripe Products**
1. Create products and prices in your Stripe dashboard
1. Return to **PostGate > Settings > Payments**
1. Click **Fetch & Sync Products** button
1. Your Stripe products will be available to select when protecting content

**Step 4: Configure Access Rules**
1. Go to **PostGate > Settings > General**
1. Choose **Lock Entire Site** for site-wide protection, or
1. Select specific post types to enable selective locking
1. Set default lock mode (Paywall or Login Only)
1. Configure bypass roles for administrators or other user roles

**Step 5: Customize Appearance**
1. Navigate to **PostGate > Settings > Appearance**
1. Choose preview mode (Paragraphs or Words)
1. Set preview limit (how much content to show before paywall)
1. Customize paywall text, badges, and button labels
1. Save your settings

**Step 6: Apply to Content**
1. Edit any post or page
1. In the PostGate sidebar panel, configure lock settings
1. Select product options for the content
1. Publish or update the post
1. Visit the post on your site to see the paywall in action

== Frequently Asked Questions ==

= How do I add a paywall to my WordPress site? =

PostGate makes it easy to add a paywall to any WordPress site. Simply install the plugin, connect your Stripe account, and choose whether to lock your entire site, specific post types, individual posts, or even specific content blocks. You can be up and running with a WordPress paywall in under 10 minutes.

= What is the best WordPress paywall plugin? =

PostGate is designed to be the most flexible WordPress paywall solution available. Unlike other paywall plugins that only offer site-wide locking, PostGate lets you create paywalls at the site, category, post, or block level. It supports both one-time purchases and recurring subscriptions, giving you complete control over how you monetize your WordPress content.

= How much does it cost to add a paywall to WordPress? =

PostGate is completely free to download and use from WordPress.org. There are no monthly fees, no setup costs, and no limits on how many paywalls you can create. You'll need a free Stripe account to process payments (Stripe charges standard payment processing fees, typically 2.9% + $0.30 per transaction in the US). To support ongoing development, security updates, and new features, PostGate applies a small 5% platform fee to transactions - significantly lower than most SaaS paywall solutions that charge $50-500+ per month.

= Do I need a Stripe account to use PostGate? =

Yes, PostGate requires a Stripe account to process payments. Stripe is a secure, PCI-compliant payment processor used by millions of businesses worldwide. You can create a free account at stripe.com.

= Can I test the plugin before going live? =

Absolutely! PostGate supports both Stripe Sandbox (test) and Live modes. Start in Sandbox mode to test the entire payment flow without processing real payments. When you're ready, switch to Live mode in the settings.

= How much does it cost to use PostGate? =

PostGate is completely free to download and use. There are no monthly fees, no setup costs, and no limits on how many paywalls you can create.

To process payments, you'll need a free Stripe account. Stripe charges standard payment processing fees (typically 2.9% + $0.30 per transaction in the US).

To support ongoing development, security updates, and new features, PostGate applies a small 5% platform fee to transactions. This is significantly lower than most SaaS paywall solutions that charge $50-500+ per month. Check Stripe's pricing page for payment processing fees in your country.

= Can I gate only specific posts instead of the entire site? =

Yes! PostGate offers multiple gating strategies:
- Lock your entire site
- Lock specific post types (posts, pages, custom post types)
- Lock individual posts or pages
- Lock categories or taxonomies
- Lock specific blocks within posts

= What happens if I change my Stripe products? =

Users who already purchased access retain their access. New purchases will use the updated products. You can sync new products from Stripe at any time using the "Fetch & Sync Products" button.

= Can users purchase access without creating an account? =

No, users must log in or create an account before purchasing. This ensures proper access management and allows users to access purchased content from any device.

= What payment methods does PostGate support? =

PostGate supports all payment methods enabled in your Stripe account, including credit cards, debit cards, Apple Pay, Google Pay, and many regional payment methods.

= Can I offer both subscriptions and one-time purchases? =

Yes! You can mix payment models. For example, offer individual articles for one-time purchase or a subscription for unlimited access. Users see all available options and choose their preference.

= How do I customize the paywall design? =

PostGate includes two built-in templates (Compact and Classic). For advanced customization, copy the template files from the plugin to your theme directory under `/postgate/templates/` and modify them as needed.

= Can I preview content before the paywall for SEO? =

Yes! PostGate includes intelligent preview functionality. You can show the first N paragraphs or N words before the paywall. This allows search engines to index your content while still protecting it.

= What happens when a subscription is canceled? =

When a subscription is canceled in Stripe, PostGate automatically receives a webhook notification and revokes the user's access to subscription-protected content.

= Can I refund purchases? =

Yes, process refunds through your Stripe dashboard. PostGate will receive a webhook notification and automatically revoke the user's access to the refunded content.

= Does PostGate work with caching plugins? =

Yes, but ensure that logged-in users are excluded from caching. Most caching plugins do this automatically. If you experience issues, add the paywall pages to your cache exclusion list.

= Can I grant access to specific user roles without payment? =

Yes! Configure bypass roles in **PostGate > Settings > General**. By default, administrators bypass all paywalls. You can add any WordPress role to the bypass list.

= Does PostGate support multiple currencies? =

Yes! PostGate supports all currencies available in Stripe. Set your preferred display currency in the settings, and users will see prices in that currency.

= Can I lock custom post types? =

Absolutely! Enable any custom post type in **PostGate > Settings > General** under "Enabled Post Types". PostGate works with any public post type.

= What if users share their login credentials? =

While PostGate doesn't prevent password sharing, you can limit this by: (1) monitoring for unusual login patterns, (2) implementing two-factor authentication with a separate plugin, or (3) using device limits if you extend the plugin.

= Is PostGate compatible with page builders? =

Yes! PostGate works with any page builder including Elementor, Divi, Beaver Builder, and others. The paywall applies at the content filter level, so it works regardless of how the content was created.

= Can I track revenue and conversions? =

PostGate includes a dashboard with order management and basic revenue tracking. For detailed analytics, use your Stripe dashboard which provides comprehensive reporting and analytics.

= What happens during plugin updates? =

Your settings, products, and user access grants are stored in the WordPress database and remain intact during updates. Always backup your database before updating any plugin.

= Does PostGate slow down my site? =

PostGate is optimized for performance. Assets only load on pages with protected content. The access check is a simple database query that adds minimal overhead.

== Screenshots ==

1. Dashboard overview with revenue and order statistics
2. General settings: site-wide lock, post types, lock mode, and bypass roles
3. Stripe Connect integration with live and sandbox modes
4. Product synchronization from Stripe with automatic updates
5. Appearance settings: preview mode, paywall customization
6. Post editor sidebar with granular lock controls
7. Compact paywall template with pricing options
8. Classic paywall template with detailed pricing display
9. Block-level content locking within posts
10. Order management with purchase history
11. Webhook configuration for Stripe integration
12. Login gate template for members-only content

== Changelog ==

= 1.0.3 =
* Fixed: Removed composer from deployment pipeline to use committed vendor directory
* Fixed: Simplified deployment by using local vendor/ instead of building with composer
* Improved: Updated build:all script to skip composer install (vendor already tracked)
* Improved: Streamlined GitHub Actions workflow to reduce deployment time

= 1.0.2 =
* Fixed: Ensured complete Stripe SDK deployment via improved .gitattributes configuration
* Fixed: Resolved issue where vendor files were excluded from WordPress.org deployment
* Improved: Added negation patterns in .gitattributes to force inclusion of vendor/stripe directory
* Improved: GitHub Actions workflow now uses optimized Composer installation flags

= 1.0.1 =
* Fixed: Stripe SDK autoloader not properly included in WordPress.org deployment
* Fixed: GitHub Actions workflow to ensure all Composer dependencies are properly installed
* Improved: Added verification checks in GitHub Actions to validate Stripe SDK files before deployment
* Improved: Enhanced error reporting for deployment workflow

== Upgrade Notice ==

= 1.0.3 =
Maintenance release: Simplified deployment pipeline and improved vendor directory handling.

= 1.0.2 =
Important update: Fixes vendor file deployment to WordPress.org. Resolves Stripe SDK loading issues reported in 1.0.1.

= 1.0.1 =
Critical update: Fixes Stripe SDK loading issues in WordPress.org deployment. Highly recommended for all users.

== Additional Information ==

**Links**
* [Read Our Quick Start Guide](https://qodesphere.tawk.help/article/quick-start-guide?utm_source=wporg&utm_medium=readme&utm_campaign=postgate)
* [Documentation](https://qodesphere.tawk.help/category/postgate-documentation?utm_source=wporg&utm_medium=readme&utm_campaign=postgate)
* [Support Forum](https://wordpress.org/support/plugin/postgate)

**Credits**
PostGate is developed and maintained by QodeSphere. Special thanks to the WordPress and Stripe developer communities for their invaluable tools and resources.

**Privacy Policy**
PostGate itself does not collect any user data. Payment processing is handled entirely by Stripe. Please review Stripe's privacy policy at stripe.com/privacy for information about how payment data is handled.
