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 stepsOpen 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.
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
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
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.
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
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.
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.
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.
Verify the paid reader
Confirm that your listener acknowledged the subscription and invoice events. Open the protected article and /account in the paying reader’s verified session. The account should show an active membership and its paid-through date without an admin granting access.
For this recording we intercepted Stripe’s return URL before it reached the site. EmDash recorded the £5.01 payment with webhook as its source. The contributor’s grant remained separate at £0.00.