PostGate – Buy a Post: Paywall with Stripe

Description

Buy a Post Paywall with Stripe lets you sell single posts. Readers pay once with Stripe Checkout and keep access to that post. They don’t need a subscription or a password.

How it works for your readers

  1. A reader sees the teaser of a post and a box with a Buy access – $9 button.
  2. They pay on Stripe’s hosted checkout page (cards, Apple Pay, Google Pay, Link, PayPal and other methods you enable in Stripe).
  3. They return to the post and get an email with a sign-in link.
  4. The link signs them in and the full post is visible. Later they sign in again by entering their email and clicking the link they receive.

Features

  • Paid Content block: put any blocks inside it (text, images, embeds …). Everything outside the block stays free.
  • Price per post in the editor sidebar, or one default price for all paid posts.
  • No products to manage in Stripe. The post title and price are sent with each checkout, so they appear on the checkout page, the receipt and in your Stripe payments list.
  • Automatic accounts. A WordPress account (role Subscriber) is created for each new buyer.
  • Passwordless sign-in with single-use magic links. Magic links only work for reader accounts, not for editors or admins.
  • Server-side protection. The paid part is removed on the server: on the page, in the REST API, in RSS feeds and in automatic excerpts. The price is set on the server and can’t be changed in the browser.
  • Secure webhooks. Every Stripe webhook is checked with its signature, and duplicate deliveries are ignored.
  • Manual access control. On the user profile you can see a user’s purchases, grant access to a post or take it away.
  • Shortcodes for a sign-in/sign-out button ([dppp_signin]) and a “My purchases” list ([dppp_my_purchases]).
  • Test and live mode. The settings page shows which Stripe mode you are using.
  • Hooks for developers (see the FAQ).

Prices are in USD.

External services

This plugin connects to the Stripe API (https://api.stripe.com) to take payments. It cannot work without a Stripe account.

  • When a reader clicks “Buy access”, your site sends Stripe the post ID, post title, price, currency and the return URLs of the post. If the reader is signed in, their email address is sent too. The reader is then sent to Stripe’s checkout page, where they enter their payment details and email directly with Stripe.
  • After payment, Stripe sends a webhook to your site with the checkout session, including the buyer’s email address and Stripe customer ID.

The service is provided by Stripe. Stripe Services Agreement: https://stripe.com/legal/ssa. Stripe Privacy Policy: https://stripe.com/privacy.

Blocks

This plugin provides 1 block.

  • Paid Content Everything inside this block is only visible to readers who bought the post.

Installation

  1. Install the plugin under Plugins Add New (or upload the ZIP), then activate it.
  2. Go to Settings Paid Posts.
  3. Connect Stripe as described in the next section.
  4. Set up SMTP for your site (for example with the WP Mail SMTP plugin and a service like Postmark, Brevo or Mailgun). Without it, sign-in emails often end up in spam or never arrive.

Connecting Stripe

You need a Stripe account. Start in test mode so you can try everything without real payments. Test mode and live mode each have their own keys and webhooks.

Step 1: Turn on test mode

Log in to the Stripe Dashboard and turn on the Test mode switch (in newer dashboards, open a sandbox).

Step 2: Copy your secret key

  1. In Stripe, go to Developers API keys.
  2. Copy the Secret key. In test mode it starts with sk_test_.
  3. In WordPress, paste it into Settings Paid Posts Secret key.

You can also use a restricted key (rk_test_… / rk_live_…) if it has write access to Checkout Sessions.

Step 3: Add the webhook

The webhook tells your site that a payment was successful. Without it, buyers don’t get access.

  1. In WordPress, open Settings Paid Posts and copy the Webhook endpoint URL in the Stripe section. It looks like https://your-site.com/wp-json/dppp/v1/stripe-webhook.
  2. In Stripe, go to Developers Webhooks and click Add endpoint (in newer dashboards: Add destination).
  3. If Stripe asks for these options, choose:
    • Events from: Your account
    • Payload style: Snapshot. Don’t choose Thin. Thin events don’t contain the buyer’s email or the post, so the plugin can’t grant access.
    • API version: keep the default.
  4. Select these two events:
    • checkout.session.completed
    • checkout.session.async_payment_succeeded
  5. If asked for the destination type, choose Webhook endpoint.
  6. Paste the URL as the endpoint URL and save.
  7. Open the endpoint, click Signing secret Reveal and copy the value. It starts with whsec_.
  8. In WordPress, paste it into Webhook signing secret.

Step 4: Set a default price

Enter a Default price (USD), for example 9. It is used for every paid post that has no price of its own. The minimum is $0.50.

Click Save Changes. The Mode row on the settings page should now show TEST.

Step 5 (optional): Customize the checkout page

In the Stripe Dashboard:

  • Settings Branding: logo, colors and business name on the checkout page.
  • Settings Payment methods: choose which payment methods your buyers see.

Step 6: Test a purchase

  1. Create a post with a Paid Content block (see below) and publish it.
  2. Open the post in a private browser window, where you are signed out. You should see the Buy access box.
  3. Click Buy access and pay with the test card 4242 4242 4242 4242, any future expiry date and any CVC.
  4. You return to the post with a thank-you message.
  5. In Stripe, open Developers Webhooks your endpoint. The delivery should show status 200.
  6. Open the email, click the link and then Continue to sign in. The full post is now visible.

Step 7: Go live

  1. Turn off test mode in Stripe.
  2. Create the same webhook again in live mode (same URL, same two events).
  3. In WordPress, replace the secret key with your live key (sk_live_…) and the signing secret with the live endpoint’s whsec_… value.
  4. Save. The Mode row now shows LIVE.

Writing a paid post

  1. Write the free teaser as usual.
  2. Add the Paid Content block (search for “paid” or “paywall”) and write the paid part inside it.
  3. Optional: in the sidebar under Post Paid content, set a Price (USD) for this post. Leave it empty to use the default price.

You can use more than one Paid Content block in a post. Readers who haven’t bought the post see one buy box where the first block is. Free text after the paid part stays visible. Editors and admins always see the full post.

Adding a sign-in button

Readers need a way to sign in on another device or after signing out. Use one of these:

  • A link to #dppp-signin. Any link ending in #dppp-signin opens the sign-in window.
  • The shortcode [dppp_signin]. It shows “Sign in” or “Sign out”. Change the labels like this: [dppp_signin signin_label="Log in" signout_label="Log out"].
  • The CSS class dppp-signin-trigger on any element.

To give buyers a list of their posts, create a page with the shortcode [dppp_my_purchases].

FAQ

Do I need to create products or prices in Stripe?

No. The plugin sends the post title and price with every checkout.

Payments go through, but buyers don’t get access. What’s wrong?

Almost always the webhook. Check that:

  • the endpoint URL in Stripe matches the one on the settings page,
  • both events are selected and the payload style is Snapshot (not Thin),
  • the signing secret in WordPress belongs to this endpoint and to the same mode (test or live) as your secret key.

In Stripe, Developers Webhooks your endpoint lists every delivery and its response. Stripe retries failed deliveries automatically. If WP_DEBUG_LOG is on, the plugin writes rejected webhooks and checkout errors to wp-content/debug.log.

Security or firewall plugins and services that block requests to /wp-json/ can also stop the webhook.

Buyers don’t receive the email.

Set up SMTP (see Installation). WordPress’s default mail function is often blocked or marked as spam.

Why does the email link open a page with a “Continue to sign in” button?

Email scanners (for example Outlook Safe Links) open links before the reader does. Because each link works only once, the scanner would use it up. The extra click prevents this.

How long are the links valid?

The link in the purchase email is valid for 7 days. A link requested through Sign in is valid for 30 minutes. Each link works once. You can change the times with the dppp_purchase_link_ttl and dppp_signin_link_ttl filters.

Can admins sign in with a magic link?

No. Admins and editors sign in with their password through wp-login.php, so someone who gets into their mailbox can’t reach the admin area. Developers can change this with the dppp_magic_link_allowed filter.

Can buyers open the WordPress dashboard?

No. Accounts the plugin creates for buyers don’t see the admin bar and are sent to the home page if they open wp-admin. Other users, for example customers of a shop plugin or existing subscribers, are not affected, even if they buy a post. Use the dppp_block_wp_admin filter to allow buyer accounts into wp-admin.

Does a refund in Stripe remove access?

No. If you refund a buyer and want to remove access, do it on their user profile under Paid posts.

Does it work with page caching?

Yes, as long as signed-in users skip the page cache. Most caching plugins do this by default. Please check your caching settings.

Is the paid text really hidden?

The paid part is removed on the server: on the page, in the REST API, in RSS feeds and in automatic excerpts. WordPress search can still find the post through words in the paid part, but it doesn’t show them. To check your site, put a unique test sentence in the paid part, sign out, and make sure it doesn’t appear in the page source, /feed, /wp-json/wp/v2/posts or the output of your SEO plugin.

Who handles sales tax and VAT?

You do. Stripe processes the payment, but you are the seller. You can turn on Stripe Tax with the dppp_checkout_session_params filter (set automatic_tax[enabled] to true) after setting it up in Stripe. If you sell to consumers in the EU, also check the rules on the right of withdrawal for digital content.

Can I use it with other post types?

Yes. Add them with the dppp_post_types filter. By default only posts are supported.

Which hooks are available?

  • dppp_post_types (filter): post types that can have paid content.
  • dppp_checkout_session_params (filter): change the Stripe Checkout Session, for example Stripe Tax, allow_promotion_codes or locale.
  • dppp_purchase_completed (action): runs after a successful purchase.
  • dppp_customer_created (action): runs after a new buyer account was created.
  • dppp_customer_role (filter): role for new buyer accounts (default subscriber).
  • dppp_user_has_access (filter): custom access rules.
  • dppp_purchase_link_ttl / dppp_signin_link_ttl (filters): how long links stay valid, in seconds.
  • dppp_magic_link_allowed (filter): allow magic links for other roles.
  • dppp_is_reader (filter): which users count as buyer accounts (admin bar hidden, no wp-admin).
  • dppp_block_wp_admin (filter): return false to let buyer accounts open wp-admin.
  • dppp_client_ip (filter): the real visitor IP behind Cloudflare or a proxy, used for rate limiting.
  • dppp_mail_headers (filter): headers for the plugin’s emails.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“PostGate – Buy a Post: Paywall with Stripe” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

2.0.0

  • Payments now use Stripe Checkout.
  • Paid sections with the Paid Content block.
  • Passwordless sign-in with magic links.