Memberships
A recurring subscription on your Stripe account that turns into member pricing on every cart — told through one promoter, one plan and one member
This page uses the same fictional promoter as
How it fits together: Halfmoon Presents,
who run gigs in a converted chapel and sell from their own site,
halfmoon.live. Halfmoon want a club: £10 a month, and club members get 20%
off every ticket. This is how that happens, in order, and what each side is
responsible for.
The reference for every field, state and error is on the second page. Read this one first.
The two objects
A membership plan is Halfmoon's recurring offer: a name, a price, a billing interval, the percentage members get off, and whether members can buy gated items. There is one plan for the club. Halfmoon could have several.
A membership is one person's subscription to one plan. It mirrors a Stripe Subscription on Halfmoon's connected account and carries a status, the end of the current billing period, and whether it is scheduled to stop.
The membership has exactly one job in the engine. It is the fact the quote looks at. Nothing else reads it. There is no members list to maintain and no code to hand out: a member gets 20% off because the engine finds an active membership when it prices their cart. What the membership is worth comes from its plan, either as a plan-wide percentage or as benefits chosen per event.
HALFMOON (halfmoon.live) THE ENGINE STRIPE
┌──────────────────────┐ ┌──────────────────────┐ ┌──────────────────┐
│ creates the plan │ ─────────────▶ │ membership plan │ ────▶ │ Product + Price │
│ │ │ │ │ on Halfmoon's │
│ Ana clicks "join" │ ─────────────▶ │ membership:incomplete│ ────▶ │ Subscription │
│ Ana pays in the page │ ─────────────────────────────────────────────▶│ invoice paid │
│ │ │ membership:active │ ◀──── │ webhook │
│ Ana opens a show │ ── quote ────▶ │ finds active member │ │ │
│ renders 20% off │ ◀── effects ── │ percent_off applied │ │ │
└──────────────────────┘ └──────────────────────┘ └──────────────────┘1. Halfmoon creates the plan, once
Halfmoon's Stripe account is already connected; see Connect. Someone at Halfmoon creates the plan, either from the Memberships page in the dashboard or by API:
POST/v1/membership_planscurl -X POST https://tickets.lissen.com/api/v1/membership_plans \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Idempotency-Key: 3f1c9a72-5b8e-4d21-9c47-0e6a2b8d4f13" \
-H "Content-Type: application/json" \
-d '{
"name": "Halfmoon Club",
"currency": "GBP",
"price_minor": 1000,
"interval": "month",
"percent_off_bps": 2000,
"unlocks_gated_items": false,
"metadata": { "halfmoon_tier": "club" }
}'Three things happen in the engine:
- A Product and a £10/month recurring Price are created on Halfmoon's connected Stripe account, and their ids are stored on the plan. Halfmoon never creates anything in Stripe by hand.
- No platform fee is fixed on the plan. The fee is read from Halfmoon's active
fee schedule for GBP (set by Lissen) each
time someone joins, and attached to that member's subscription. Only the
percentage applies to a subscription; the flat amount and mode do not. No
schedule for the currency makes the join, not the plan, answer
fee_schedule_not_found, never a membership without the fee. A later schedule change does not rewrite the fee on subscriptions that already exist. - Membership pricing is switched on for Halfmoon. Creating the first plan is the consent act. From now on, every quote for a Halfmoon cart consults memberships.
Notice what Halfmoon did not configure: which events, which items, or which
tiers the 20% covers. The plan's own percent_off_bps and
unlocks_gated_items are the plan-wide, legacy way to give members something:
they cover every item Halfmoon sells, at every event, including events created
later. To give a discount or an unlock only at chosen events or tickets, define
a benefit instead. Either way a membership is a
standing property of the buyer, unlike a
discount code, which is presented and spent.
The currency and interval are fixed; the price can change. name,
active, percent_off_bps, unlocks_gated_items and the enrollment
settings can be changed later. If the club ever becomes £12, Halfmoon
changes the plan's price and every member pays £12 from their next renewal:
see Changing the price. To charge only new members
£12 and keep everyone who joined at £10, create a new plan instead.
2. Ana joins on halfmoon.live
Ana has an account on Halfmoon's site, stored in their database as
usr_4471. She clicks "Join the club". Halfmoon's server, not her browser,
creates the membership:
curl -X POST https://tickets.lissen.com/api/v1/memberships \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Idempotency-Key: 7a2d5e90-1c3b-4f68-8d0a-9b4e6c2f1a57" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "mpl_0199c4f0-1a2b-7c3d-8e4f-5a6b7c8d9e01",
"customer": {
"external_ref": "usr_4471",
"email": "ana@example.com",
"name": "Ana Reyes"
}
}'external_ref is Halfmoon's own id for Ana, and Halfmoon's API key is what
vouches for it. There are no anonymous memberships, and email is contact
detail, not identity. The engine:
- finds or creates Ana's customer record under Halfmoon, keyed by that reference;
- creates a Stripe Subscription on Halfmoon's account, in Stripe's incomplete state, with the platform fee attached;
- records a membership in status
incomplete, and answers201with the membership and the credentials Ana's browser needs to pay.
{
"membership": {
"id": "mbs_0199c4f0-2b3c-7d4e-9f50-6b7c8d9e0f12",
"object": "membership",
"plan_id": "mpl_0199c4f0-1a2b-7c3d-8e4f-5a6b7c8d9e01",
"customer_id": "cus_0199c4f0-3c4d-7e5f-a061-7c8d9e0f1a23",
"status": "incomplete",
"current_period_end": null,
"cancel_at_period_end": false,
"started_at": null,
"ended_at": null,
"price_minor": 1000,
"price_applies_at": null,
"created_at": "2026-11-02T10:14:08.000Z",
"metadata": {}
},
"payment": {
"payment_intent_client_secret": "pi_..._secret_...",
"connected_account_id": "acct_...",
"publishable_key": "pk_test_..."
}
}Halfmoon's page initialises Stripe.js for connected_account_id, mounts a
Payment Element with the client secret, and calls
confirmPayment({ redirect: "if_required" }). Ana enters her card. The £10
lands in Halfmoon's Stripe balance, less the platform fee. This is the same
pattern as checkout: Halfmoon builds no payment
form of its own and never sees a card number.
A 201 is not a member. The membership is incomplete until Stripe
reports the first invoice paid. Do not show Ana "you're in" from the create
response. Poll GET/v1/memberships/{id} until
status is active, or wait for membership.activated on your
activity stream.
The create is idempotent, and Ana cannot hold two live memberships on the same plan. What a second join does depends on the one she already has:
incomplete, and its first payment is still awaited. The join resumes it: the same membership comes back with fresh payment credentials, and no activity is recorded. Mount the Payment Element again with the new client secret. This is not pausing, resuming or undoing a cancellation; it only finishes a join that never paid.incomplete, but Stripe has already expired that first payment. The old attempt is retired ascanceledand a new membership and subscription are created.incomplete, but Stripe has already activated the subscription and the webhook has not reached the engine yet. The join answers409membership_already_exists. Retrieve the membership and wait for it to becomeactive; do not cancel it.activeorpast_due. The join answers409membership_already_exists.
3. Stripe says the invoice was paid
Stripe sends the engine an invoice.paid event for Halfmoon's account. The
engine re-reads the subscription from Stripe rather than trusting the event
body, then moves the membership to active, sets started_at and
current_period_end, and emits membership.activated.
That is the moment Ana is a club member. Nothing else in the engine changes. Halfmoon's webhook handler can now insert a row in their own database if they want one, but they do not have to: the engine will find her membership when it matters.
4. Ana opens a show page
Ana is on the Low Tide Choir page. Halfmoon's server prices the cart, and this is the line that makes memberships work: it names Ana on the quote.
POST/v1/quotescurl -X POST https://tickets.lissen.com/api/v1/quotes \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Content-Type: application/json" \
-d '{
"line_items": [
{ "item_id": "itm_0199c4e3-77a2-7e19-b0c5-9d3f2a4e6b10", "quantity": 2 }
],
"customer": { "external_ref": "usr_4471" }
}'The engine looks up the customer behind usr_4471, finds an active
membership on a plan with 20% off, and applies it to every line. General
Admission is £15.00; Ana pays £12.00 a ticket.
{
"mode": "preview",
"currency": "GBP",
"subject": { "kind": "authenticated", "customer_id": "cus_0199c4f0-3c4d-7e5f-a061-7c8d9e0f1a23", "external_ref": "usr_4471" },
"line_items": [
{
"item_id": "itm_0199c4e3-77a2-7e19-b0c5-9d3f2a4e6b10",
"description": "General Admission",
"quantity": 2,
"unit_list_price_minor": 1500,
"unit_price_minor": 1200,
"discount_minor": 600,
"subtotal_minor": 2400,
"effect_ids": ["membership:mpl_0199c4f0-1a2b-7c3d-8e4f-5a6b7c8d9e01:percent_off"],
"sellable": true
}
],
"applied_effects": [
{
"id": "membership:mpl_0199c4f0-1a2b-7c3d-8e4f-5a6b7c8d9e01:percent_off",
"provider_kind": "membership",
"type": "percent_off",
"state": "applied",
"source": {
"kind": "membership",
"label": "Halfmoon Club",
"plan_id": "mpl_0199c4f0-1a2b-7c3d-8e4f-5a6b7c8d9e01",
"membership_id": "mbs_0199c4f0-2b3c-7d4e-9f50-6b7c8d9e0f12"
},
"description": "20% off with Halfmoon Club",
"percent_bps": 2000,
"stackable": false,
"consumable": false
}
],
"unapplied_effects": []
}Halfmoon renders unit_price_minor and strikes through
unit_list_price_minor, and can show "20% off with Halfmoon Club" straight
from source. They compute nothing.
The same page opened by someone who is not logged in, or logged in but not a
member, prices at £15.00 and returns the club as a teaser in
unapplied_effects, with requires.display reading "Join Halfmoon Club for
20% off". That is the upsell, and it is built from plan configuration only.
No email or personal data is in it.
Forget the customer and the member sees list prices. The discount exists
only because Halfmoon passed usr_4471 on this call. A quote with no
customer is anonymous, and an anonymous cart has no memberships.
5. Ana buys
Halfmoon creates a checkout session for the two
tickets with the same customer. The session takes its own binding quote,
finds the same active membership, and holds the price at £12.00 a ticket
until Ana has paid. The £24.00 plus fees is charged on Halfmoon's Stripe
account like any other order.
The order and its two positions are ordinary. Nothing on a ticket says "member"; the membership shaped the price and then stepped back.
6. Months later: renewal, a failed card, leaving
Every month Stripe bills the subscription and sends another invoice.paid.
The engine records membership.renewed and moves current_period_end
forward. Halfmoon does nothing.
If Ana's card fails, Stripe sends invoice.payment_failed and the membership
becomes past_due. Unless the plan has a
benefit grace period, from
that moment her carts price at list and the club appears as a teaser again. With a
grace period of, say, five days, her membership stays past_due but keeps its
benefits until the grace_ends_at on the membership, and loses them then unless
she has paid. Tickets she already bought are untouched: an
issued ticket is valid at the door regardless of what happens to the
membership afterwards. Chasing the payment is Stripe's and Halfmoon's
business; the engine has no dunning screens.
Ana can fix the card herself. Halfmoon's account page asks the engine for a hosted payment-method update and sends her to the Stripe page it returns:
POST/v1/memberships/{id}/payment_method_update_sessionscurl -X POST https://tickets.lissen.com/api/v1/memberships/mbs_0199c4f0-2b3c-7d4e-9f50-6b7c8d9e0f12/payment_method_update_sessions \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Content-Type: application/json" \
-d '{ "return_url": "https://halfmoon.live/account" }'Ana enters the new card on Stripe and lands back on halfmoon.live/account.
Her plan, price and renewal date are untouched. Because her membership is
past_due, the engine then tries the new card once on the overdue invoice;
when it is paid her membership is active again, recorded as
membership.renewed. If that card is declined too, she stays past_due and
Stripe keeps retrying. Halfmoon can also charge the overdue invoice whenever
Ana asks, with next_charge and "at": "now". The
reference covers
which payment method the membership then bills.
If Ana cancels, Halfmoon's server calls
POST/v1/memberships/{id}/cancel. That sets
cancel_at_period_end on Stripe and mirrors it on the membership. She keeps
20% off until the period ends. When Stripe reports the subscription ended,
the membership becomes canceled with ended_at set, and she can join again
later as a new membership.
Members who already paid: a first charge date
Before the engine, Halfmoon sold its club on an old shop. Leo paid there for a year that runs until 15 January. Halfmoon moves him across without charging him twice: the join says when his first charge is.
curl -X POST https://tickets.lissen.com/api/v1/memberships \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Idempotency-Key: 3e9b1c40-5d2a-4f17-9c8e-1a6d4b2f7e03" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "mpl_0199c4f0-1a2b-7c3d-8e4f-5a6b7c8d9e01",
"customer": { "external_ref": "usr_5120", "email": "leo@example.com" },
"first_charge_at": "2027-01-15T12:00:00Z"
}'The answer has no payment. It has a setup instead, with the same three
fields in the same places, and the membership's next_charge_at is
15 January:
{
"membership": { "status": "incomplete", "next_charge_at": "2027-01-15T12:00:00.000Z", "...": "..." },
"payment": null,
"setup": {
"setup_intent_client_secret": "seti_..._secret_...",
"connected_account_id": "acct_...",
"publishable_key": "pk_test_..."
}
}Halfmoon's page mounts the Payment Element with that secret and calls
confirmSetup instead of confirmPayment. Leo saves his card and is charged
nothing. He saves it here even if he already has a card on file from another
membership: each join's first charge waits for the card saved for it. The engine hears it from Stripe and the membership becomes active
with membership.activated: he is a member now, with the plan's benefits. On
15 January Stripe charges £10 and renews monthly from there; that charge is
recorded like a renewal, and a declined card is a failed renewal, with the
plan's grace period. If he cancels before then he keeps the benefits until the
date and is never charged. A card he never saves ends the join after about a
day, as an unpaid one does. The
reference has
the limits.
Mia joined before Halfmoon knew her old shop date, and her old year runs to 1 March. Halfmoon moves her next charge there; she keeps everything until then, and nothing is credited or charged for the difference:
POST/v1/memberships/{id}/next_chargecurl -X POST https://tickets.lissen.com/api/v1/memberships/mbs_0199c4f0-2b3c-7d4e-9f50-6b7c8d9e0f12/next_charge \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Idempotency-Key: 5a1f0c2e-7b3d-4e8f-9a61-2c4d6e8f0a13" \
-H "Content-Type: application/json" \
-d '{ "at": "2027-03-01T12:00:00Z" }'"at": "now" instead charges a full month now and renews from today, as a
renewal; to try that out in test mode, see
Testing renewals. The
reference has
the rules.
Moving existing members
Halfmoon's old shop charged its members on Halfmoon's own Stripe account, so
their cards are already saved there. Leo's Customer on that account is
cus_Q1oldshop and his card is pm_1Q2oldshop. To move him, Halfmoon's
server joins him with that card and the date his paid year runs out. He does
nothing.
curl -X POST https://tickets.lissen.com/api/v1/memberships \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Idempotency-Key: 7c2e9a14-0b3d-4e6f-8a1c-5d9b2f4e6a80" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "mpl_0199c4f0-1a2b-7c3d-8e4f-5a6b7c8d9e01",
"customer": { "external_ref": "usr_5120", "email": "leo@example.com" },
"first_charge_at": "2027-01-15T12:00:00Z",
"saved_payment_method": {
"stripe_customer_id": "cus_Q1oldshop",
"stripe_payment_method_id": "pm_1Q2oldshop"
}
}'Leo is a member at once, and nothing is charged until 15 January:
{
"membership": { "status": "active", "next_charge_at": "2027-01-15T12:00:00.000Z", "...": "..." },
"payment": null,
"setup": null
}On 15 January Stripe charges £10 to that card and renews monthly from there.
The engine now uses cus_Q1oldshop for Leo's later memberships too.
A few things to check for each member:
- The Customer must be on Halfmoon's connected account with the card attached to it, and must not already belong to another of Halfmoon's customers. Otherwise the join refuses and creates nothing.
- A member whose paid time has already run out joins without
first_charge_at: the card is charged now. If it is declined, the join answerspayment_declinedand creates nothing. If the bank wants the member to authenticate, the answer has apaymentsecret for them to complete on Halfmoon's page. - If the old shop saved a card without the member's permission to charge it
while they are away, the bank may ask for authentication on the first
charge. That charge then fails like a renewal: the membership becomes
past_due, with the plan's grace period. Stripe does not retry it by itself.
The reference has every rule and refusal.
Pausing, restarting and changing her mind
Ana tells Halfmoon she is away for two months. Halfmoon's server calls
POST/v1/memberships/{id}/pause with an
Idempotency-Key. Her £10 plan is paused on Stripe straight away, halfway
through a paid month, so about £5 of unused time is credited toward her
next invoice (not refunded). Her membership becomes paused,
membership.paused arrives on the activity stream, and her next quote prices
at list because a paused membership gives no benefits. Tickets she already
bought stay valid.
When she is back, Halfmoon calls
POST/v1/memberships/{id}/resume. Stripe starts a
fresh month from today at her membership's price, applies the credit and charges the
difference, about £5. If that payment succeeds, Stripe reports the
subscription active, her membership returns to active with a new
current_period_end, membership.resumed is recorded and her 20% is back. If
the payment fails, the membership stays paused, her benefits stay off and no
membership.resumed is recorded; the response carries payment credentials
when the invoice can be paid, or membership_resume_payment_failed when
Stripe refused the payment outright.
A different customer, Leo, cancelled at period end and then changed his mind.
POST/v1/memberships/{id}/undo_cancellationclears the scheduled cancellation: no charge, the same price and renewal date, and no gap in his benefits. Once a membership has actually ended, there is nothing to undo: he joins again as a new membership. The reference lists the rules and refusals.
Changing the price
A year on, Halfmoon's club goes up to £12 a month. Halfmoon emails its members a month ahead and, on the date it announced, changes the plan's price:
POST/v1/membership_plans/{id}/pricecurl -X POST https://tickets.lissen.com/api/v1/membership_plans/mpl_0199c4f0-1a2b-7c3d-8e4f-5a6b7c8d9e01/price \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Idempotency-Key: 5b8e3f1c-9a72-4d21-8c47-2b8d4f130e6a" \
-H "Content-Type: application/json" \
-d '{ "price_minor": 1200 }'The answer is the plan, now at price_minor: 1200. It is the same plan: its
id, its 20%, its benefits and its settings are unchanged. The engine creates a
£12/month Price on the plan's Stripe Product, with the same tax treatment as
the £10 one, and records membership_plan.updated. Anyone who joins from now
on pays £12.
Then, in the background, every member of the plan moves to £12: within
minutes for most plans, longer for one with thousands of members, and the
members whose renewal is soonest first. A renewal Stripe bills before its member
has moved is still £10, once. Nothing is charged at the switch and nothing is prorated:
Ana has paid for this month at £10, and her next renewal is £12. Each member's
move records membership.updated, whose membership shows the new
price_minor (1200) and price_applies_at, the renewal at which £12 is first
charged. Halfmoon can thank each member from those facts, or read
GET/v1/memberships/{id} to show "£12 from 3 December".
The move follows each member's situation:
- Overdue. If Ana's renewal had failed, that open £10 invoice stays £10 (Stripe cannot change an invoice it has issued); the renewal after it is £12.
- Paused. A paused member pays £12 when they resume, less the credit from
the pause. They are moved when they resume, so their
price_minorstays 1000 and theirprice_applies_atempty until then. - Leaving at period end. Leo, scheduled to cancel, is moved too. It changes nothing unless he undoes the cancellation, and then he renews at £12.
- Not yet paid. A member whose first payment is still awaited pays that first invoice at the amount it was issued with; their first renewal is £12.
- Joining right now. Someone who joins after the call pays £12 from the start. A join that was already under way when the price changed is moved with the members, like a member who has not paid yet.
There is no date to schedule: the change applies from each member's next renewal after the call, so Halfmoon calls it on the day it told members. There is also no way to keep existing members at £10 on this plan. A free plan has no price to change, and a paid plan cannot become free.
If Halfmoon decides to give Ana a month back, it refunds that payment through
POST/v1/refunds with the payment's
membership_charge_id. Her membership carries on exactly as it was; if
Halfmoon also wants her gone, it cancels her membership as a separate step. See
Refunding a membership payment.
Free plans: Halfmoon Friends
Halfmoon also want a free tier: anyone with an account can join Halfmoon Friends and get 5% off, no card needed. That is a plan priced at zero:
curl -X POST https://tickets.lissen.com/api/v1/membership_plans \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Idempotency-Key: 5b8e2f14-9d3a-4c67-8e21-7f0a3c9d6b42" \
-H "Content-Type: application/json" \
-d '{
"name": "Halfmoon Friends",
"currency": "GBP",
"price_minor": 0,
"percent_off_bps": 500
}'Leave interval out or send null: a free plan has nothing to bill, so it
never renews. Sending an interval with a zero price, or a positive price
without one, is refused. Nothing is created in Stripe, so a free plan needs
neither a connected account nor a fee schedule. Creating it still switches
membership pricing on, exactly like a paid plan.
Take Leo, another Halfmoon account holder who is not in the club. When Leo joins Friends, Halfmoon's server makes the same POST/v1/memberships call as before. The answer is different in the two places that matter:
{
"membership": {
"id": "mbs_0199c4f1-4d5e-7f60-8a72-8d9e0f1a2b34",
"object": "membership",
"plan_id": "mpl_0199c4f1-3c4d-7e5f-9061-7c8d9e0f1a23",
"customer_id": "cus_0199c4f0-3c4d-7e5f-a061-7c8d9e0f1a23",
"status": "active",
"current_period_end": null,
"cancel_at_period_end": false,
"started_at": "2026-11-02T10:20:31.000Z",
"ended_at": null,
"created_at": "2026-11-02T10:20:31.000Z",
"metadata": {}
},
"payment": null
}The membership is already active, and payment is null because there is
nothing to pay: no Payment Element, no confirmation and no polling. Halfmoon
can say "you're in" straight from this response. membership.created and
membership.activated arrive on the activity stream together.
Everything after that is the paid story without Stripe. The next quote that
names Leo applies 5% off. (Had Ana joined Friends too, her quotes would not
change: only the best membership discount applies, and her club 20% beats
Friends' 5%.) There is no billing period, so current_period_end
stays null and there are no renewals, invoices or ledger entries. Joining
twice while the first is live is still membership_already_exists, and the
create is idempotent. A free membership and a paid one on different plans can
be held side by side; joining one never changes the other.
When Leo leaves Friends,
POST/v1/memberships/{id}/cancel ends the free
membership immediately: it comes back canceled with ended_at set,
membership.canceled is recorded, and Leo's next quote prices at list. There
is no paid-through period to wait for. Tickets Leo already bought stay valid,
as they do for a paid member.
Making one plan the way into another
Halfmoon want their paid club open only to people who already belong to Family. They set that on the club plan, once:
curl -X POST https://tickets.lissen.com/api/v1/membership_plans/mpl_0199c4e2-8a1b-7c20-9d31-5e6f7a8b9c0d \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Content-Type: application/json" \
-d '{ "required_plan_id": "mpl_0199c4f1-3c4d-7e5f-9061-7c8d9e0f1a23" }'Now a join on the club plan from someone without an active Family
membership comes back 422 membership_prerequisite_not_met, and Stripe is
never called. detail.required_plan_name says "Family", ready to show. Once
Ana's Family membership is active she can join the club the usual way, with
the same POST/v1/memberships call; nothing is
enrolled or charged because she qualified. If her Family membership later
lapses, her club membership carries on under its own lifecycle. The
reference has
the full rules.
Choosing between alternative plans
Halfmoon sell two paid ways in: Founding for the first supporters and Standard for everyone after. A supporter should be on one of them, never both, but the free Friends plan is separate and can sit alongside either. They put Founding and Standard in one group, once, and leave Friends out:
curl -X POST https://tickets.lissen.com/api/v1/membership_plans/mpl_0199c4e2-8a1b-7c20-9d31-5e6f7a8b9c0d \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Content-Type: application/json" \
-d '{ "exclusive_group": "Paid offers" }'(The same call on the other plan puts it in the group too.) Ana joins Friends
and Founding: allowed. Leo joins Friends and Standard: allowed. When Ana later
tries to join Standard as well, the join comes back 409
membership_group_conflict, detail.plan_name says "Founding", and Stripe is
never called. The same holds while her Founding membership is still awaiting its
first payment, overdue, paused, or set to cancel at the end of the period; it
frees up only once that membership has actually ended. Halfmoon's site decides
how to explain the choice; the engine switches nobody and cancels nothing. The
reference
has the full rules, including how to see customers who already hold two
alternatives.
A limited founding offer
Halfmoon want a founding tier for their first 25 members, and a way to stop
taking more once a night is sold on membership. The plan has two settings for
this, and neither is active:
curl -X POST https://tickets.lissen.com/api/v1/membership_plans \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Idempotency-Key: 5b9e2c41-7d0a-4e83-b1f6-3a8c0d2e7f94" \
-H "Content-Type: application/json" \
-d '{
"name": "Halfmoon Founders",
"currency": "GBP",
"price_minor": 1000,
"interval": "month",
"percent_off_bps": 2000,
"member_cap": 25
}'The plan reads back with "enrollment": { "status": "open", "places_left": 25 },
which is what Halfmoon's page shows next to the button. Each join takes a
place; a paid join holds its place while Ana is paying and keeps it for good
once the first invoice is paid. If she walks away from the Payment Element,
the place comes back. When the 25th place goes, the plan reads
"status": "full" and a join answers 409 membership_enrollment_full
without touching Stripe.
The twenty-five keep everything they signed up for: their price, their
renewals, their benefits. Even if one of them cancels, the offer stays full;
it does not quietly start selling a "founding" place again. Halfmoon can also
close any plan by hand with { "enrollment_open": false }, with or without a
cap, and reopen it the same way.
Enrollment is not activation. active: false retires a plan: nobody can
join and members stop getting its price effects. Enrollment only decides who
may still join. The reference
has the counting rules and every refusal.
Earning a plan by attending
Halfmoon want a Regulars tier nobody pays for or joins: go to four Halfmoon nights in a year and you are in. The numbers are configuration, not code. They put an attendance rule on a free plan:
curl -X POST https://tickets.lissen.com/api/v1/membership_plans \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7" \
-H "Idempotency-Key: 0f2b6a8c-41de-4b7e-93a5-6c1d8e7f2a90" \
-H "Content-Type: application/json" \
-d '{
"name": "Halfmoon Regulars",
"currency": "GBP",
"price_minor": 0,
"attendance_rule": {
"threshold": 4,
"window_months": 12,
"retention": "maintain",
"scope": "selected_events"
}
}'Halfmoon answered two questions the engine will not answer for them.
Retention: keep leaves the membership with the customer however old
their visits get; maintain ends it once they no longer have four visits in
the last twelve months, and they earn it again by getting back to four.
Scope: all_events counts every Halfmoon event; selected_events counts
only the events that say so. Halfmoon chose selected events, so on each
night's page, or with one call, they make the event count:
curl -X PUT https://tickets.lissen.com/api/v1/events/evt_0199c4d0-5a6b-7c8d-9e0f-1a2b3c4d5e6f/qualifying_plans/mpl_0199c4f1-3c4d-7e5f-9061-7c8d9e0f1a23 \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7"Next season's events do not exist yet, and that is fine: Halfmoon pick the plan when they create each event. Counting toward a membership is separate from the benefits that event offers: an event can count without offering Regulars anything, and the reverse.
Nobody joins Regulars: POST/v1/memberships on it
answers 422 membership_plan_earned_only. Ana buys tickets and goes to the
door. A ticket she only bought, or a second ticket scanned at the same show,
adds nothing; the door scan that admits her adds a visit, once per event.
When her fourth visit is recorded, in that same step, the engine creates her
Regulars membership, already active with source: "earned".
membership.created and membership.activated follow the attendance.recorded
activity on the stream, with a system actor named attendance_rule:<plan id>.
Halfmoon's site can show her progress at any time:
curl "https://tickets.lissen.com/api/v1/membership_plans/mpl_0199c4f1-3c4d-7e5f-9061-7c8d9e0f1a23/qualification?customer_id=cus_0199c4f0-3c4d-7e5f-a061-7c8d9e0f1a23" \
-H "Authorization: Bearer tk_test_..." \
-H "Ticketing-Organizer: org_0199c4e2-1f7a-7c31-8d44-2b9f6a1e05c7"{
"object": "membership_qualification",
"visits_counted": 3,
"threshold": 4,
"qualified": false,
"qualified_until": null,
"membership_id": null,
"earned": false
}"3 of 4" is visits_counted of threshold. Once she qualifies,
qualified_until says when it lapses if she attends nothing more, which is
what a maintain plan needs to warn her. Earned plans can be the way into a
paid plan too: set the Regulars plan as the paid club's required_plan_id
and the earned membership is what unlocks the join. The paid membership is
still hers to join; earning Regulars subscribes and charges nobody. The
reference has the exact
rules for the window, corrections, explicit removal and edits.
Benefits chosen per event
A year on, Halfmoon add a Family plan and want finer control: Family members get 10% off, but only at the shows Halfmoon choose, and club members get a presale on some gated tickets. A plan-wide percentage cannot say that. A membership benefit can: a reusable discount or unlock that belongs to one plan and applies only where an event selects it.
Define the benefit once, before any event. A percent_off benefit carries
its own percent_off_bps; an unlock benefit is permission to buy gated
items, which the member still pays for; a fee_waiver benefit, which has no
other fields, waives the booking fee. Defining one changes no price.
{ "plan_id": "mpl_…", "name": "Family discount", "kind": "percent_off", "percent_off_bps": 1000 }Select it from the event. When Halfmoon set up the Low Tide Choir show, they assign Family discount to the whole event, or only to chosen tickets:
PUT/v1/events/{id}/membership_benefits/{benefit_id}{ "scope": "event" }From then on, a quote that names a Family member discounts that show's tickets by 10%, and the applied effect names the benefit as well as the plan and the membership:
{
"id": "membership:mpl_…:benefit:mbn_…",
"type": "percent_off",
"percent_bps": 1000,
"applies_to_item_ids": ["itm_…", "itm_…"],
"source": {
"kind": "membership",
"label": "Family",
"plan_id": "mpl_…",
"membership_id": "mbs_…",
"benefit_id": "mbn_…"
},
"description": "10% off with Family"
}The rules that follow from it:
- Only where assigned. A show Halfmoon did not select, including every show created later, prices at list for a Family member. Removing the last assignment makes the benefit give nothing; it never falls back to every event.
- Only for members of its plan. A Friends member does not get Family's 10%. A free plan can have benefits of its own, assigned the same way.
- The best membership discount wins, once. If Ana is in both Family and the club, and the club has a 20% benefit assigned only to the show's standard ticket, she pays 20% on the standard ticket and Family's 10% on the others, never 30%. Plan-wide percentages compete in the same way. A benefit applies once to a ticket however its assignments overlap.
- Unlocks name only the assigned gated tickets. A presale unlock assigned to "Members presale" makes that ticket sellable to club members and leaves every other gated ticket gated.
- No booking fee where a waiver is assigned. A
fee_waiverbenefit assigned to the show's standard ticket sets that line'sbooking_fee_minorto 0 for a Family member, on top of the 10% off; the platform fee is unchanged and comes out of Halfmoon's proceeds, as with afee_waiverdiscount code. If the member also enters such a code, the membership's waiver is the one used and the code is reported superseded and is not spent. On a ticket so cheap that Halfmoon could not absorb the platform fee, the waiver steps aside: the member pays the ordinary booking fee and the quote still succeeds. - Teasers are just as narrow. A visitor who is not a member sees "Join Family for 10% off" only on a cart that contains tickets Family discount is assigned to, "Join Family to skip the booking fee" only on the tickets a fee waiver is assigned to and would waive a booking fee on for a member buying the same cart with the same codes (not on a ticket where the waiver would step aside), and an unlock teaser only for an assigned gated ticket.
- Edits are live; bought prices are not. Changing Family discount to 15% prices the next quote at 15% at every show it is assigned to. An open checkout session keeps its binding quote at 10%; only an update or refresh of that session prices it again, and once payment has started it cannot change at all. A completed order keeps the effects recorded on it. An earlier preview on an event page is not a promise: its next quote uses 15%.
The plan's percent_off_bps and unlocks_gated_items keep working beside
benefits exactly as before, across every event, and nothing converts them into
benefits. The reference
lists every benefit and assignment route and refusal.
Letting members bring a guest
Halfmoon's Family members may bring friends to the shows Halfmoon choose, two per show. The invitation page is Halfmoon's; the engine owns who may invite and how many tickets are left.
Define the allowance once, and assign it like any benefit. units is
Halfmoon's choice, counted per event or over a calendar period (a week, a month
or a year, in UTC) shared by every show it is assigned to:
{ "plan_id": "mpl_…", "name": "Bring a friend", "kind": "guest_invitation", "guest_allowance": { "units": 2, "mode": "per_event" } }Show what is left. When Ana opens the invitation page for Low Tide Choir, Halfmoon reads her allowance and renders the remaining tickets:
GET/v1/memberships/{id}/guest_allowanceInvite. Ana types her friend's email. Halfmoon's backend, which knows she is signed in as that member, calls the engine with her membership and an Idempotency-Key:
POST/v1/guest_invitations{ "membership_id": "mbs_…", "benefit_id": "mbn_…", "item_id": "itm_…", "recipient": { "email": "sam@example.com", "name": "Sam" } }The engine checks her membership, the benefit's scope, what is left and the
show's capacity together, then issues a free ticket held by Sam, who needs no
account. Halfmoon sends Sam the ticket from order.created like any comp. Ana's
allowance drops by one ticket and the answer says what remains; nothing she or
Sam does later gives it back by itself. If Sam cancels and Halfmoon's rules
give Ana the place back, Halfmoon returns the unit. The
reference has the bucket
rules, every refusal and the audit list.
Free entry for members
The engine never asks whether the recipient is someone other than the member: Halfmoon's invitation screen decides who the recipient is. So the same call can give Ana her own free ticket, which is how a club offers its members free entry with a limit, one per show or one a month. Use two benefits on the plan, so that her own entry and her friends are counted apart:
| Benefit | Allowance | What Halfmoon's screen does |
|---|---|---|
| Your free entry | { "units": 1, "mode": "per_event" }, or { "units": 1, "mode": "per_period", "period": "month" } for one a month at any assigned show | Names Ana as the recipient |
| Bring a friend | { "units": 2, "mode": "per_event" } | Names the friend, as above |
Assign both to the shows like any benefit. To give Ana her entry, Halfmoon's
backend invites her own customer (the membership's customer_id, or her email
or external_ref) with the free-entry benefit:
{ "membership_id": "mbs_…", "benefit_id": "mbn_… (Your free entry)", "item_id": "itm_…", "recipient": { "id": "cus_… (Ana's customer_id)" } }The answer is the usual 201: a free ticket, with Ana as the order's customer
and the holder, charged to her free-entry allowance. Three things follow:
- The allowance is counted per member, per benefit. Ana's free entry is
spent only against the benefit you named, so it never uses up Bring a friend.
If you point a single benefit at both uses, her own entry and her friends
share one allowance. Once it is spent, the next invitation is refused with
invitation_allowance_exceeded, whoever the recipient is. - The free ticket counts towards the show's
max_tickets_per_customer. It is a ticket in Ana's name like any she buys, so a later purchase by her is checked against the limit with it included. The free entry itself is never refused for the limit. To let her buy four more on top of it, set the limit to five. - The visit is Ana's attendance. The ticket is admitted at the door like any other, and the visit is credited to the holder, so it counts as her own attendance towards plans earned by attending.
Putting members first on a waitlist
When a Halfmoon show sells out, Family members should be first in line for a
ticket that comes back. A waitlist_priority benefit says so, assigned like
any benefit:
{ "plan_id": "mpl_…", "name": "First in line", "kind": "waitlist_priority" }When Ana joins a sold-out ticket's waitlist, Halfmoon names her as on a cart,
with customer: { "external_ref": "usr_4471" }. When a refund or failed
payment frees a unit of that ticket, the engine offers it to waiting members
whose current membership has the benefit assigned there, in the order they
joined, before anyone else. Membership is judged when the unit is offered, so
joining Family after the waitlist still counts and leaving it no longer does.
An organizer's own promotion of a named entry is unchanged. The
waitlist guide has the details.
What each side owns
| Halfmoon | The engine | Stripe |
|---|---|---|
Who Ana is (usr_4471), her login, the join page, the show page | The plan, the membership row and its status | The Product, Price, Subscription and invoices on Halfmoon's account |
Passing customer on every quote and session | Turning an active membership into price effects | Charging the card each period |
| Rendering prices and teasers the quote returns | Reconciling status from Stripe's events | Reporting paid, failed and ended |
| Deciding when to offer "cancel", "pause", "resume" and "undo cancellation" | Scheduling cancellation at period end, pausing and restarting the subscription, ending a free membership at once | Ending the subscription, pausing invoices, calculating the credit |
| The "update card" button and who may press it | A single-use hosted link for the member's own Stripe customer, and keeping the subscription on the new card | The page where the card is entered |
Everything Halfmoon needs to build is on this page: one create call, one
Payment Element, one poll, and customer on every cart. The
reference has the full field list, every
state and the errors that can come back.