Appearance
Subscriptions
Plans, trials, subscriptions, seats, gifts, promo codes, store purchases and entitlements. All paths are under /v1. Responses use { data, meta }; lists add meta.nextCursor and meta.hasMore. Errors are RFC 9457 Problem Details with a code. Money is { amountMinor, currency } in minor units.
Auth: public means no token is needed and req.actor may be absent. user means a platform access token. staff:<perm> means a staff token holding that permission. Idem marks routes that need an Idempotency-Key header because they move money.
Lifecycle
trialing → active → past_due → grace → expired. cancelled and expired are final. Benefits continue in trialing, active, past_due and grace.
- Cancel: schedules
cancelAtPeriodEnd. When the subscription ispast_dueorgrace, it ends at once instead. - Renewals: run 1 h before the period ends. A renewal that fails moves to
past_due, retried everySUBSCRIPTIONS_DUNNING_RETRY_HOURS × attempthours up toSUBSCRIPTIONS_DUNNING_MAX_ATTEMPTSattempts. After that it moves tograce, which lasts until the period end plusSUBSCRIPTIONS_GRACE_DAYS, then toexpired. - Trials: a trial whose conversion charge fails, or that has no payment method, expires at its end.
- Plan changes: a higher price in the same period pays the prorated difference now, less any credit. Weekly to monthly starts a new monthly period now, less the unused week. A lower price, or monthly to weekly, waits for the period end.
Plans
| Method | Path | Auth | Body / query | Response | Errors |
|---|---|---|---|---|---|
| GET | /subscription-plans | public | ?currency=NGN&platform=ios|android|web (or channel=direct|apple|google) | PlanView[], only plans with a price in that currency; on ios and android each price carries its store products | — |
| GET | /subscription-plans/:code | public | same query | PlanView (price null if not sold in that currency) | PLAN_NOT_FOUND |
| GET | /staff/subscriptions/plans/:planId | staff:users:read | — | StaffPlan with prices and store products | PLAN_NOT_FOUND |
| GET | /staff/subscription-plans | staff:users:read | — | StaffPlan[], with prices and store products | — |
| POST | /staff/subscription-plans | staff:settings:manage | {code, name, kind, period, seatCount?, maxAddonSeats?, benefit flags?, assistantQuota?, isTrialEligible?, isActive?, sortOrder?} | 201 StaffPlan | PLAN_CODE_TAKEN |
| PATCH | /staff/subscription-plans/:id | staff:settings:manage | any plan field except code, kind and period | StaffPlan | PLAN_NOT_FOUND, SEAT_ADDON_UNAVAILABLE |
| PUT | /staff/subscription-plans/:id/prices | staff:settings:manage | {prices:[{channel, currency, amountMinor, addonSeatAmountMinor, isActive}]} | StaffPlan | PLAN_NOT_FOUND |
| GET | /staff/subscriptions/plans/:planId/prices/:priceId/store-products | staff:users:read | — | StaffStoreProduct[] | PLAN_NOT_FOUND, PLAN_PRICE_UNAVAILABLE |
| POST | /staff/subscriptions/plans/:planId/prices/:priceId/store-products | staff:settings:manage | {store: apple|google, kind?: plan|addon_seat, productId, basePlanId? (Google), offerId? (Google), subscriptionGroupId? (Apple), environment?: sandbox|production, isActive?} | 201 StaffStoreProduct | STORE_PRODUCT_TAKEN, STORE_PRODUCT_CHANNEL_MISMATCH (the price's channel must be that store), SEAT_ADDON_UNAVAILABLE |
| PATCH | /staff/subscriptions/plans/:planId/prices/:priceId/store-products/:productId | staff:settings:manage | {kind?, isActive?}; IDs never change, so add a new row instead | StaffStoreProduct | STORE_PRODUCT_NOT_FOUND |
| DELETE | /staff/subscriptions/plans/:planId/prices/:priceId/store-products/:productId | staff:settings:manage | — | {status:"ok"}. Prefer isActive: false, so older purchases still resolve | STORE_PRODUCT_NOT_FOUND |
PlanView is {id, code, name, description, kind: individual|student|duo|family, period: weekly|monthly, seatCount, maxAddonSeats, benefits:{fullPlayback, offline, lossless, adFree, listenTogether, assistantQuota}, isTrialEligible, trialDays, requiresStudentVerification, price, addonSeatPrice, storeProducts:[{store, kind, productId, basePlanId, offerId, subscriptionGroupId}]}.
Store product IDs are data. No product ID appears in code. Staff link each App Store or Play product to one plan price: one row per store, environment, product, base plan and offer. The public list shows the products for the server's store environment (APPLE_IAP_ENVIRONMENT for Apple, production for Play). Editing prices keeps their IDs: prices are updated in place by channel and currency, and a removed price is retired, not deleted. Every store product change is audited.
My subscription
| Method | Path | Auth | Body / query | Response | Errors |
|---|---|---|---|---|---|
| GET | /me/subscription | user | — | {subscription: SubscriptionView|null, entitlements, pendingCharge: ChargeView|null} | — |
| GET | /me/entitlements | user | — | Entitlements | — |
| GET | /me/subscription/trial-eligibility | user | ?deviceId | {isEligible, reason: eligible|already_used|contact_unverified, trialDays} | — |
| POST | /me/subscription/trial | user (5/h), idempotency optional | {planCode, currency, deviceId, method?, paymentMethodId?, promoCode?} | 201 SubscriptionView | TRIAL_NOT_ELIGIBLE, TRIAL_CONTACT_REQUIRED, SUBSCRIPTION_ALREADY_ACTIVE, PLAN_STUDENT_VERIFICATION_REQUIRED, PLAN_PRICE_UNAVAILABLE, PROMO_CODE_* |
| POST | /me/subscription | user, Idem | {planCode, currency, method: wallet|card|bank_transfer, promoCode?} | 201 Checkout (the subscription starts when payment settles) | SUBSCRIPTION_ALREADY_ACTIVE, PLAN_*, PROMO_CODE_*, DEPENDENCY_UNAVAILABLE |
| POST | /me/subscription/cancel | user (owner) | {reason?, note?} | SubscriptionView | SUBSCRIPTION_NOT_FOUND, SUBSCRIPTION_NOT_OWNER, SUBSCRIPTION_CHANNEL_MISMATCH |
| POST | /me/subscription/resume | user (owner) | — | SubscriptionView | SUBSCRIPTION_INVALID_TRANSITION |
| PUT | /me/subscription/payment-method | user (owner) | {method} | SubscriptionView (turns auto-renew on) | SUBSCRIPTION_CHANNEL_MISMATCH |
| POST | /me/subscription/pay | user (owner), Idem | — | 201 Checkout, a manual retry while past_due or grace | SUBSCRIPTION_INVALID_TRANSITION, SUBSCRIPTION_PAYMENT_PENDING |
| POST | /me/subscription/plan-change/preview | user (owner) | {planCode} | {effect: immediate|period_end, charge, creditAfter, periodStart, periodEnd, targetPlanCode} | SUBSCRIPTION_PLAN_UNCHANGED, PLAN_* |
| POST | /me/subscription/plan-change | user (owner), Idem | {planCode} | {quote, checkout: Checkout|null, subscription} | as preview, plus SUBSCRIPTION_PAYMENT_PENDING |
| GET | /me/subscription/charges | user | ?cursor&limit | page of ChargeView, both paid by and paid for this person | — |
| POST | /me/subscription/promo-codes/validate | user (20/h) | {code, planCode, currency, purpose: charge|trial} | {code, discountType, durationPeriods, extraTrialDays, price, discount, firstCharge} | PROMO_CODE_INVALID, PROMO_CODE_NOT_APPLICABLE, PROMO_CODE_EXHAUSTED, PROMO_CODE_USER_LIMIT |
| GET | /staff/users/:userId/subscription | staff:users:read | — | same as GET /me/subscription | — |
SubscriptionViewis{id, role: owner|member, status, channel: direct|apple|google|gift, plan, pendingPlanCode, currentPeriodStart, currentPeriodEnd, trialEnd, graceUntil, autoRenew, cancelAtPeriodEnd, paymentMethod, addonSeats, nextChargeAt, nextChargeAmount, credit, canManage}. A member sees no payment details.Checkoutis{charge: ChargeView, payment: {id, status, checkoutUrl}}. OpencheckoutUrlwhen it's set.ChargeViewis{id, kind, status, channel, grossAmount, discountAmount, creditApplied, amount, serviceStart, serviceEnd, checkoutUrl, createdAt, settledAt}.Entitlementsis{canPlayFull, canDownload, adFree, lossless, listenTogether, isTrial, isPaid, planCode, maxSeats, assistantQuota}.
Seats (duo, family)
| Method | Path | Auth | Body | Response | Errors |
|---|---|---|---|---|---|
| GET | /me/subscription/seats | user (owner) | — | {subscriptionId, capacity, addonSeats, maxAddonSeats, pendingAddonSeats, addonSeatPrice, seats: SeatView[]} | SEAT_PLAN_HAS_NO_SEATS |
| POST | /me/subscription/seats | user (owner) | {userId} | 201 SeatView; the invitee is notified | SEAT_SELF, SEAT_LIMIT_REACHED, SEAT_ALREADY_MEMBER, SEAT_INVITE_INVALID, USER_NOT_FOUND |
| DELETE | /me/subscription/seats/:seatId | user (owner) | — | {status:"ok"} | SEAT_NOT_FOUND |
| POST | /me/subscription/seats/leave | user (member) | — | {status:"ok"} | SEAT_NOT_FOUND |
| POST | /me/subscription/addon-seats | user (owner), Idem | {quantity} | 201 Checkout, prorated for the rest of the period (free during a trial) | SEAT_ADDON_UNAVAILABLE, SEAT_LIMIT_REACHED |
| POST | /me/subscription/addon-seats/remove | user (owner) | {quantity} | seats view; takes effect at the next renewal | VALIDATION_FAILED |
| GET | /me/seat-invites | user | — | [{id, subscriptionId, ownerUserId, planCode, planName, inviteExpiresAt}] | — |
| POST | /me/seat-invites/:seatId/accept | user | — | SeatView | SEAT_INVITE_INVALID, SEAT_ALREADY_MEMBER, SEAT_LIMIT_REACHED |
| POST | /me/seat-invites/:seatId/decline | user | — | {status:"ok"} | SEAT_INVITE_INVALID |
Gift and pay-for-me links
| Method | Path | Auth | Body | Response | Errors |
|---|---|---|---|---|---|
| POST | /me/subscription/gift-links | user (recipient) | {planCode, currency, periods?, message?} | 201 {link, token, url}. The token is shown only once | PLAN_* |
| GET | /me/subscription/gift-links | user | ?cursor&limit | page of GiftLinkView | — |
| DELETE | /me/subscription/gift-links/:id | user | — | {status:"ok"} | GIFT_LINK_NOT_FOUND, GIFT_LINK_CLOSED |
| GET | /subscription-gifts/:token | public (60/min per IP) | — | GiftLinkView | GIFT_LINK_NOT_FOUND, GIFT_LINK_CLOSED |
| POST | /subscription-gifts/:token/checkout | user (payer), Idem | {method} | 201 Checkout | GIFT_SELF, GIFT_LINK_CLOSED |
| POST | /subscription-gifts | user (payer), Idem | {recipientUserId, planCode, currency, periods?, method, message?} | 201 Checkout | GIFT_SELF, PLAN_* |
When the payment settles, the gift is applied as follows. With no subscription, the recipient gets a non-renewing gift subscription. A trial ends and becomes paid time on the gifted plan. Anything else is extended by the gifted time and keeps its plan. The recipient is notified.
Store purchases
| Method | Path | Auth | Body | Response | Errors |
|---|---|---|---|---|---|
| POST | /me/subscription/store/apple | user (30/h) | {receipt}: a StoreKit 2 JWS transaction or a transaction ID | GET /me/subscription shape | STORE_RECEIPT_INVALID, STORE_PURCHASE_TAKEN, SUBSCRIPTION_ALREADY_ACTIVE, STORE_UNAVAILABLE |
| POST | /me/subscription/store/google | user (30/h) | {productId, purchaseToken} | as above | as above |
| POST | /webhooks/subscriptions/apple | Apple signature | App Store Server Notifications V2 {signedPayload} | {status:"accepted"} | STORE_NOTIFICATION_INVALID |
| POST | /webhooks/subscriptions/google?token=… | shared token | Pub/Sub push {message:{data, messageId}} | {status:"accepted"} | STORE_NOTIFICATION_INVALID |
Google Play billing switch. While GOOGLE_PLAY_BILLING_ENABLED is false, Android subscribes through the direct checkout (webCheckoutPath, POST /v1/me/subscription) with wallet or card. ?platform=android then returns direct prices with the Play products marked inAppAvailable: false. POST /me/subscription/store/google answers STORE_BILLING_OFF (422, with a subscribe-on-the-web action). The Google webhook is acknowledged and dropped. Google store-product rows are kept for when billing is turned on.
Receipts and webhooks resolve the purchased product to a plan price through the store products table, using Google's base plan and offer and the transaction's environment. An unknown product answers STORE_PRODUCT_UNKNOWN (422, contact_support). A webhook for one is recorded as ignored with that reason and never retried. A product of kind addon_seat sets the owner's family add-on seats to the number of live add-on purchases. Gifts and pay-for-me links are direct payments only, because the stores can't buy for another account.
Webhooks are verified and recorded in the request, deduplicated by notification ID, then processed on payments-webhook. Apps should set appAccountToken (Apple) or obfuscatedAccountId (Google) to the user ID. A store subscription is managed in the store, so cancel and plan change answer SUBSCRIPTION_CHANNEL_MISMATCH.
Promo codes (staff)
| Method | Path | Auth | Body / query | Response | Errors |
|---|---|---|---|---|---|
| GET | /staff/promo-codes | staff:users:read | ?cursor&limit&campaign | page of StaffPromo | — |
| POST | /staff/promo-codes | staff:settings:manage | {code, discount:{discountType:percent, percentOff}|{fixed, amountOffMinor, currency}|{extra_trial_days, extraTrialDays}, campaign?, description?, durationPeriods?, maxRedemptions?, perUserLimit?, isNewSubscribersOnly?, startsAt?, endsAt?, isActive?, planCodes?} | 201 StaffPromo | PROMO_CODE_TAKEN, PLAN_NOT_FOUND |
| PATCH | /staff/promo-codes/:id | staff:settings:manage | any field except code and discount | StaffPromo | NOT_FOUND |
| GET | /staff/subscriptions/promo-codes/:id | staff:users:read | ?cursor&limit (redemptions) | {promo: StaffPromo (planIds scope, limits, redemptionCount), redemptions: page} | NOT_FOUND |
| GET | /staff/promo-codes/:id/redemptions | staff:users:read | ?cursor&limit | page of redemptions | — |
A percent or fixed code discounts the first durationPeriods charges. On a trial, those are the charges from conversion onwards.
Events and notifications
- Event
subscriptions.subscription.changed:{subscriptionId, ownerUserId, affectedUserIds, change, status, planCode, occurredAt}. - Notifications use type codes
subscription.trial_started|trial_ending|trial_ended|activated|renewed|payment_failed|expired|gift_received|seat_invite, each with the email template of the same key.trial_endedusessubscription.expired.
Seats by email
POST /me/subscription/seats takes one of userId, profileId, handle or email. An email that belongs to a verified account invites that account. Otherwise an invite email goes out and a pending seat (counting against capacity) waits; it becomes an ordinary invite the first time the person signs in with that verified email and opens GET /me/subscription/invites. Seat rows carry member { displayName, avatarUrl } | null and invitedEmail (pending email invites only, with memberUserId: null). DELETE /me/subscription/seats/:seatId also withdraws a pending email invite.