Guides
Selling
What is this for? Paid newsletters on FlockStack
Set up payments
On FlockStack Cloud, each account connects its own Stripe account from the Payments page (connect_payments): Stripe's page takes you through its details, and the account stays yours, with its own dashboard for payouts, refunds and disputes. get_payments_status says when it can take charges. On a self-hosted server, set STRIPE_SECRET_KEY and sales go to that Stripe account.
Stripe sends what happens to sales to https://flockstack.io/api/webhooks/payments. Add that endpoint in Stripe with the events below and put its signing secret in STRIPE_PAYMENTS_WEBHOOK_SECRET. On FlockStack Cloud, choose to listen to events on connected accounts.
- checkout.session.completed
- checkout.session.async_payment_succeeded
- charge.refunded
- charge.dispute.created
- customer.subscription.created
- customer.subscription.updated
- customer.subscription.deleted
- customer.subscription.paused
- customer.subscription.resumed
- invoice.paid
- invoice.payment_failed
- invoice.finalized
- invoice.voided
- invoice.marked_uncollectible
- invoice.updated
- account.updated
- account.application.deauthorized
Digital products
create_product makes a draft, set_product_file stores its file (up to 15 MB), and update_product with status active puts it on sale at /shop/<slug> on the newsletter's site. The reader pays with Stripe Checkout; when Stripe confirms the payment, FlockStack makes the order and emails them a download link from the newsletter's address.
The file lives in a private bucket and is never served from a public address. The link is signed, works for 7 days and 20 downloads, and stops when the order is refunded in full or disputed. resend_order_email sends a new link and ends the old one. A buyer can tick a box to join the newsletter's list; the newsletter's own signup rules, a confirmation email included, apply.
curl https://flockstack.io/api/v1/products \
-H "Authorization: Bearer $FLOCKSTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Launch checklist","priceCents":1900}'Paid subscriptions
set_paid_tier turns a newsletter's paid tiers on with a currency, an optional free trial and a pitch; readers subscribe on its /subscribe page. Stripe tells FlockStack when a subscription starts, renews, is cancelled or fails to pay, and each contact is paid or free accordingly, with paidUntil as the end of the period they paid for. A failed renewal makes the reader free at once; the next successful payment brings them back.
A campaign has an audience: all, free or paid. A paid issue goes to paid readers only, shows a teaser on its web page and has the whole text in the email. Everything that protects a send applies to it as to any other: plan limits, pacing, the list cleanup (a paid reader is never set aside) and the suppression lists. Paid readers get a manage-subscription link in every email, which opens their Stripe billing page.
Paid tiers
A newsletter has up to 3 paid tiers, lowest first (list_paid_tiers, create_paid_tier, update_paid_tier, delete_paid_tier, reorder_paid_tiers). Each has a name, a description, benefits and the prices it asks: monthly, quarterly (every 3 months), yearly, lifetime (one payment that never renews) and pay what you want (the reader names the price, above a minimum). Once the paid tier is open, FlockStack makes each tier a Product on your Stripe account with a Price per way to pay, so your Stripe dashboard and invoices show real products. A price can't change in Stripe: a new amount makes a new Price, and readers already subscribed keep the one they signed up on.
Tier order is the order of importance. A paid issue can go to every paid tier, or to one tier and the tiers above it (paidTier on create_campaign and update_campaign). A segment can filter on a reader's tier, and subscriber.upgraded and subscriber.downgraded webhooks carry the tier. A tier that readers hold can't be deleted: archive it, and it leaves the subscribe page while its readers keep it.
A paused subscription sends subscriber.paused after the subscriber.downgraded that says the paid issues stopped, and subscriber.resumed after the subscriber.upgraded when it is active again. Both carry the tier, the billing interval and the subscriber, and each is sent once per change.
A newsletter that had a paid tier before tiers keeps it: one tier named Paid subscription with its monthly and yearly prices, and its readers hold it. It is written out as the lowest tier the first time you add another.
Founding members
A tier with founding.enabled is a founding or supporter tier: the same issues as any paid tier, for more money, shown on the subscribe page as a way to back the writer. founding.cap limits how many members it takes; when it is full the tier leaves the page and checkout refuses more. The cap is checked as a reader starts paying, so two readers finishing at once can take it a member past its cap.
set_paid_tier with supportersPublic shows a supporters list on the subscribe page. It is off by default. Checkout then asks a founding member for a name to list, which is optional; the page shows names only, never emails. list_supporters shows the writer who is listed, and set_supporter_name changes a name or takes it off.
Pledges
A writer who hasn't opened the paid tier can turn on pledges (set_pledges). A reader picks a tier and a monthly or yearly price on the subscribe page and enters a card, which is saved on your Stripe account with a SetupIntent and not charged. The page says so, the reader gets an email saying the same with a link to cancel, and they stay on the free list. A pledger has no paid access until they are charged. get_pledge_report counts the pledges and totals them per tier.
start_pledge_charging needs the paid tier on. It emails every pledger the day of their first charge, noticeDays ahead (7 by default, 1 to 30), with a link that cancels the pledge with one click. On that day each card is charged off-session by creating a subscription on your Stripe account, at the price they pledged unless honorPledgedPrice is false. A pledger who canceled is not charged; a refused card is marked failed and the pledger is told; a pledger whose notice couldn't be emailed is not charged. The work runs in QStash steps that save their place: a step that fails is retried from where it stopped, a subscription is made once per pledge, and starting again after a failure carries on with the same run. stop_pledge_charging stops it until the charge day; get_pledge_charging shows where it is.
Offers and trials
create_offer makes a discount (percent or amount off, once, repeating for some months or forever, with maxRedemptions and expiresAt) as a coupon on your Stripe account, or a free trial (trial, or trialDays on a discount). A coupon's terms can't change in Stripe, so an offer's can't either: make another. Every offer has a link, /offer/<code> on the newsletter's site, that shows the discounted price and applies the coupon at checkout. A trial can ask for no card until it ends (trialNoCard, or the same switch on set_paid_tier for every trial): Stripe then asks for a card when the trial is over, and a reader who doesn't add one is dropped.
list_offers and get_offer report each offer: how many readers signed up through it, how many of them pay now, and who. set_launch_banner shows a line above the website while the paid tier is open, linking to an offer, and it hides itself when the offer ends.
Gift subscriptions
set_gifts turns on gifts for a newsletter with its paid tier open. The gift page, /give on the newsletter's site, sells 1, 3, 6 or 12 months of a tier: a year is the yearly price, a quarter the quarterly price when there is one, and the rest are months of the monthly price. The buyer names the recipient, writes a message (plain text, no links) and picks the day it is sent, up to a year ahead, and pays once with Stripe Checkout on your account. A lifetime or pay what you want tier isn't given.
When the payment is confirmed the buyer gets a receipt with a page that lists their gifts and whether each was redeemed. On the chosen day (a job per gift, with an hourly check behind it) the recipient gets one email from the newsletter with the message and a link. Redeeming gives paid access for the gift's months from that day, or from when their other paid time ends, as a gift: it is shown apart from paying readers. An unredeemed gift expires 12 months after it was bought. The payment stays with you, and refunding it in Stripe is yours to do; a full refund of a redeemed gift takes the access back. list_gifts shows every gift and resend_gift sends one again, to another address if the first didn't reach.
Comp access and the paid report
grant_comp_access gives a contact paid access by hand until a day, in a tier: for press, partners or a favor. The contact has to be on the list and active already, because paid issues are email they would otherwise not have asked for. The access ends on its day by itself (an hourly check clears it and tells webhooks), or sooner with revoke_comp_access. A comp is shown apart: a contact's paidAccess says stripe, comp or gift, and a reader who also pays with a Stripe subscription keeps paying while the comp waits behind it.
get_paid_report counts paying readers, comps and gifts per tier. Only paying readers count towards its monthly revenue, which is an estimate at list prices: it leaves out comps, gifts, lifetime payments and discounts. Your Stripe dashboard has the exact figures.