Appearance
Plans, trial, seats, gifts and promo codes
Who: listener (owner, seat member, gift payer or recipient); staff for plans and promo codes; system for renewals.
Entry points
| Kind | Entry |
|---|---|
| REST (plans) | GET /subscription-plans?currency&channel, GET /subscription-plans/:code |
| REST (trial) | GET /me/subscription/trial-eligibility?deviceId, POST /me/subscription/trial |
| REST (subscribe) | POST /me/subscription/promo-codes/validate, POST /me/subscription (Idempotency-Key), GET /payments/:id, POST /payments/:id/refresh |
| REST (manage) | GET /me/subscription, GET /me/entitlements, POST /me/subscription/cancel, /resume, PUT /me/subscription/payment-method, POST /me/subscription/pay, POST /me/subscription/plan-change/preview, POST /me/subscription/plan-change, GET /me/subscription/charges |
| REST (seats) | GET/POST /me/subscription/seats, DELETE /me/subscription/seats/:seatId, POST /me/subscription/seats/leave, POST /me/subscription/addon-seats, /addon-seats/remove, GET /me/seat-invites, POST /me/seat-invites/:seatId/accept, /decline |
| REST (gifts) | POST/GET /me/subscription/gift-links, DELETE /me/subscription/gift-links/:id, GET /subscription-gifts/:token, POST /subscription-gifts/:token/checkout, POST /subscription-gifts |
| REST (stores) | POST /me/subscription/store/apple, /google; webhooks POST /webhooks/subscriptions/apple, /google |
| Staff | /staff/subscription-plans…, /staff/promo-codes…, GET /staff/users/:userId/subscription |
| Deep link | subscribe, trial, subscription, seatInvite, gift, verifyStudent |
| Push/email | subscription.* types below |
Flow: trial
GET /me/subscription/trial-eligibility→eligible | already_used | contact_unverified. One trial per person: account, verified contact, device key (payment fingerprint is not checked yet, see gaps).POST /me/subscription/trial { planCode, currency, deviceId, method?, promoCode? }→ subscriptiontrialingwith full benefits fortrialDays(7, plus promo extra days). Eventsubscriptions.subscription.changed.subscriptions.sweep(scheduled) sendssubscription.trial_ending, then converts at trial end: charge succeeds →active; no method or failed charge → expired (subscription.trial_ended).
Flow: subscribe
- Optional
POST /me/subscription/promo-codes/validate(percent, fixed or extra trial days; scope, limits, windows). POST /me/subscription { planCode, currency, method: wallet|card|bank_transfer, promoCode? }→Checkout { charge, payment { checkoutUrl } }. Wallet usually settles at once; card and transfer opencheckoutUrl(Hyparrow).- Payment settles (
wallet.webhook-processjob, orpayments-sweep) →wallet.payment.succeeded→ subscriptionactive→subscription.activated; entitlements cache dropped. - Renewal 1 h before period end (
subscriptions.sweep). Failure →past_due(dunning retries) →grace→expired. Notificationssubscription.renewed,subscription.payment_failed,subscription.expired. - Store channel: the app lists plans with
?platform=ios|androidto get each price's store product IDs. Staff set these at/staff/subscriptions/plans/:planId/prices/:priceId/store-products; none are hard-coded. After buying in the store,POST /me/subscription/store/apple|googlevalidates the receipt and resolves the product to a plan price. An unknown product answersSTORE_PRODUCT_UNKNOWN. Later state comes from store webhooks (subscriptions.store-notificationjob). A family add-on seat product sets add-on seats; gifts stay direct-only.
Flow: family and 2geda seats
Plan kinds duo (2geda, 2 seats) and family (4) carry seatCount; family can buy add-on seats.
- Owner
POST /me/subscription/seats { userId }→ seatinvited, invitee getssubscription.seat_invite(deep linkseatInvite). - Invitee
POST /me/seat-invites/:seatId/accept→ member; entitlements follow the owner's subscription.decline, ownerDELETE …/seats/:seatId, memberPOST …/seats/leave. - Add-on:
POST /me/subscription/addon-seats { quantity }→ proratedCheckout(free during a trial); remove takes effect at renewal.
Flow: gift and pay-for-me
- Pay-for-me: recipient
POST /me/subscription/gift-links→{ token, url }(deep linkgift). Payer opensGET /subscription-gifts/:token(public) →POST /subscription-gifts/:token/checkout { method }. - Gift: payer
POST /subscription-gifts { recipientUserId, planCode, … }. - On settlement: no subscription → non-renewing
gift; trial → becomes paid time; otherwise extended. Recipient getssubscription.gift_received.
Exit states
| State | Code | Actions | Client next |
|---|---|---|---|
| Trial or plan active | — | — | Refetch GET /me/entitlements, play full |
| Trial used | TRIAL_NOT_ELIGIBLE | subscribe | Plans screen |
| Contact unverified | TRIAL_CONTACT_REQUIRED | verify_email, verify_phone | Verify, retry |
| Already subscribed | SUBSCRIPTION_ALREADY_ACTIVE | open | Subscription screen |
| Store-managed | SUBSCRIPTION_CHANNEL_MISMATCH | open | Send to App Store / Play |
| Payment pending | SUBSCRIPTION_PAYMENT_PENDING | wait | Poll GET /payments/:id |
| Student plan | PLAN_STUDENT_VERIFICATION_REQUIRED | verify_identity | Always refused today (I17) |
| Price missing | PLAN_PRICE_UNAVAILABLE, PLAN_NOT_FOUND | — | Pick another currency/plan |
| Promo | PROMO_CODE_INVALID, PROMO_CODE_NOT_APPLICABLE, PROMO_CODE_EXHAUSTED, PROMO_CODE_USER_LIMIT | — | Clear the code |
| Seats | SEAT_PLAN_HAS_NO_SEATS, SEAT_LIMIT_REACHED, SEAT_ALREADY_MEMBER, SEAT_SELF, SEAT_INVITE_INVALID, SEAT_ADDON_UNAVAILABLE | — | Show the title |
| Gift | GIFT_LINK_NOT_FOUND, GIFT_LINK_CLOSED, GIFT_SELF | — | Empty state |
| Store receipt | STORE_RECEIPT_INVALID (contact_support), STORE_PURCHASE_TAKEN, STORE_UNAVAILABLE (retry) | as listed | — |
| Wallet | WALLET_INSUFFICIENT_FUNDS | top_up | Top up |
Notifications
subscription.trial_started, trial_ending, trial_ended, activated, renewed, payment_failed, expired, gift_received, seat_invite; receipt payment.receipt.