EmDash Memberships

Publisher tutorial

Your first
membership.

Follow one article from the print room to a reader’s screen. Set its price, give a contributor access, and take a test payment.

Follow the steps
The walkthroughDownload film
Step 01

Open the directory guide

Start with EmDash Memberships in the EmDash plugin directory. Check the publisher handle, then open the Installation section. The directory release contains the guide. The npm package supplies the paywall, reader sessions and Stripe integration.

The public directory lists EmDash Memberships under @emdashmemberships.bsky.social.
The public directory lists EmDash Memberships under @emdashmemberships.bsky.social.
Step 02

Install the npm package

From your Astro 6 project, install the package and import emCashPlugin in astro.config.mjs. Add emCashPlugin() to the existing EmDash plugins array and keep your current database and storage configuration. Use server output.

pnpm add @simplethingsltd/emdash-memberships@0.5.0
The directory installation section shows the package name and native plugin setup.
The directory installation section shows the package name and native plugin setup.
Step 03

Wire up the reader pages

Add a membership page to list plans, an account page for email sign-in, and a server-rendered post page that selects either the preview or the full body before rendering. The agent guide includes working examples of all three. Start EmDash locally and open /_emdash/admin. This site starts with one editable article, “Inside the print room”.

Use a Stripe sandbox key for the rehearsal. Set PUBLIC_SITE_URL to the local origin and STRIPE_WEBHOOK_SECRET to the signing secret from your local Stripe listener. Keep both Stripe secrets in the local environment. With the correct sandbox selected in the Stripe CLI, forward events to your site.

stripe listen --forward-to http://localhost:4335/_emdash/api/plugins/em-cash/stripe-webhook
EmDash’s first-run screen offers the template’s sample posts on the new site.
EmDash’s first-run screen offers the template’s sample posts on the new site.
Step 04

Create a membership plan

In Plugins, open em-cash, then EmDash Memberships. Under Create access plan, set Apply to to Collection, enter posts as the target, and choose Membership. Set the monthly price to £5.01, Preview words to 35, and the plan name to Field Notes. Press Create rule. This applies to every entry in the posts collection.

Version 0.5.0 with EmDash 1.6 supplies a £0.01 minimum but omits the price field’s decimal step. The browser accepts £5.01 in this form. For a round price with this release, use EM_CASH_SEED_PLANS as described in the agent guide.

The plan editor pairs the posts collection with its membership price and preview.
The plan editor pairs the posts collection with its membership price and preview.
Step 05

Read as a visitor

Open the article in a signed-out browser. Read the introduction and the offer, then check that the later member paragraph is absent from the page source. Keep reader-specific responses private. Configure the search migration to index only the public title and excerpt, and run it against the local database.

pnpm exec em-cash-protected-search local
A visitor sees the opening of the print-room story and the membership offer.
A visitor sees the opening of the print-room story and the membership offer.
Step 06

Invite a contributor

Open the plugin’s Members page at /_emdash/admin/plugins/em-cash/members. Under Give access, enter a contributor’s email, choose Field Notes, and add a note. Submit and look for an active grant. On /account, request a sign-in link for that address. The development email provider prints it locally. Open the link and press Sign in.

The Members screen records the email grant separately from paid subscriptions.
The Members screen records the email grant separately from paid subscriptions.
Step 07

Open the member edition

Revisit the article in the signed-in contributor’s browser. Read past the public introduction into the full story. This reader has access without a Stripe charge. Keep this browser separate from the reader you use to test payment.

The same article now includes the paragraphs reserved for members.
The same article now includes the paragraphs reserved for members.
Step 08

Join through Stripe

Open /membership in a separate browser session and choose Field Notes. Enter a different address, open its verification link, confirm, then choose the subscription again. Stripe’s hosted Checkout shows the monthly price and the Sandbox label. Use the 4242 test Visa with a future expiry and a three-digit CVC. Press Pay and subscribe.

The hosted sandbox Checkout offers the monthly Field Notes subscription.
The hosted sandbox Checkout offers the monthly Field Notes subscription.