Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/parrot-wing/wp-subscription-gate/archive/refs/heads/main.zipStripe Checkout annual subscription for mailbox provisioning. No paid plugin dependency.
How It Works
- User fills in email prefix + domain dropdown + password on the registration page.
- Plugin creates a Stripe Checkout Session (subscription mode, annual) and redirects to Stripe.
- On successful payment, Stripe sends a webhook to
/wp-json/wpsg/v1/stripe-webhook. - The webhook handler verifies the Stripe signature, then calls
wp_create_user()— the SHA512-Pass plugin ensures the password hash is Dovecot-compatible SHA512-CRYPT. - User is redirected to a welcome page.
Requirements
- WordPress with the SHA512-Pass plugin active
- Dovecot authenticating against
wp_usersviapassword_query - PHP 8.3+ with curl, mbstring, json
- Stripe account with a Product and annual Price configured
Installation
-
Clone this repo into
wp-content/plugins/wp-subscription-gate/. The Stripe PHP SDK is bundled — no Composer needed. -
Activate the plugin in WordPress Admin → Plugins.
-
Go to Settings → Subscription Gate Stripe and paste your Stripe credentials (Secret key, Publishable key, Price ID, Webhook signing secret). Use test keys (
sk_test_,pk_test_) and a test Price ID first.As an alternative, you can define the constants in
wp-config.phpbefore the "stop editing" line — they take priority over the settings page:define('WPSG_STRIPE_SECRET_KEY', 'sk_...'); define('WPSG_STRIPE_PUBLISHABLE_KEY', 'pk_...'); define('WPSG_STRIPE_PRICE_ID', 'price_...'); define('WPSG_STRIPE_WEBHOOK_SECRET', 'whsec_...'); -
Create a page with slug
welcome— users land here after payment. -
On your registration page, use the shortcode
[wpsg_register]. -
In Stripe Dashboard → Developers → Webhooks, create an endpoint at
https://your-domain/wp-json/wpsg/v1/stripe-webhooklistening for:checkout.session.completed,invoice.paid,customer.subscription.deleted,invoice.payment_failed. -
Test with Stripe's test card
4242 4242 4242 4242before switching to live keys.
Shortcode
[wpsg_register]
Renders: email prefix input + domain dropdown + password + confirm password. The domain list defaults to ['initrix.com']. Use the filter wpsg_registration_domains to customize.
Credentials
Stripe credentials are configured in WordPress Admin → Settings → Subscription Gate Stripe and stored in the database as wpsg_stripe_* options. If the WPSG_STRIPE_* constants are defined in wp-config.php, they take priority. No secret values are committed to this repository.