Skip to content

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 is past_due or grace, it ends at once instead.
  • Renewals: run 1 h before the period ends. A renewal that fails moves to past_due, retried every SUBSCRIPTIONS_DUNNING_RETRY_HOURS × attempt hours up to SUBSCRIPTIONS_DUNNING_MAX_ATTEMPTS attempts. After that it moves to grace, which lasts until the period end plus SUBSCRIPTIONS_GRACE_DAYS, then to expired.
  • 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 ​

MethodPathAuthBody / queryResponseErrors
GET/subscription-planspublic?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/:codepublicsame queryPlanView (price null if not sold in that currency)PLAN_NOT_FOUND
GET/staff/subscriptions/plans/:planIdstaff:users:read—StaffPlan with prices and store productsPLAN_NOT_FOUND
GET/staff/subscription-plansstaff:users:read—StaffPlan[], with prices and store products—
POST/staff/subscription-plansstaff:settings:manage{code, name, kind, period, seatCount?, maxAddonSeats?, benefit flags?, assistantQuota?, isTrialEligible?, isActive?, sortOrder?}201 StaffPlanPLAN_CODE_TAKEN
PATCH/staff/subscription-plans/:idstaff:settings:manageany plan field except code, kind and periodStaffPlanPLAN_NOT_FOUND, SEAT_ADDON_UNAVAILABLE
PUT/staff/subscription-plans/:id/pricesstaff:settings:manage{prices:[{channel, currency, amountMinor, addonSeatAmountMinor, isActive}]}StaffPlanPLAN_NOT_FOUND
GET/staff/subscriptions/plans/:planId/prices/:priceId/store-productsstaff:users:read—StaffStoreProduct[]PLAN_NOT_FOUND, PLAN_PRICE_UNAVAILABLE
POST/staff/subscriptions/plans/:planId/prices/:priceId/store-productsstaff:settings:manage{store: apple|google, kind?: plan|addon_seat, productId, basePlanId? (Google), offerId? (Google), subscriptionGroupId? (Apple), environment?: sandbox|production, isActive?}201 StaffStoreProductSTORE_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/:productIdstaff:settings:manage{kind?, isActive?}; IDs never change, so add a new row insteadStaffStoreProductSTORE_PRODUCT_NOT_FOUND
DELETE/staff/subscriptions/plans/:planId/prices/:priceId/store-products/:productIdstaff:settings:manage—{status:"ok"}. Prefer isActive: false, so older purchases still resolveSTORE_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 ​

MethodPathAuthBody / queryResponseErrors
GET/me/subscriptionuser—{subscription: SubscriptionView|null, entitlements, pendingCharge: ChargeView|null}—
GET/me/entitlementsuser—Entitlements—
GET/me/subscription/trial-eligibilityuser?deviceId{isEligible, reason: eligible|already_used|contact_unverified, trialDays}—
POST/me/subscription/trialuser (5/h), idempotency optional{planCode, currency, deviceId, method?, paymentMethodId?, promoCode?}201 SubscriptionViewTRIAL_NOT_ELIGIBLE, TRIAL_CONTACT_REQUIRED, SUBSCRIPTION_ALREADY_ACTIVE, PLAN_STUDENT_VERIFICATION_REQUIRED, PLAN_PRICE_UNAVAILABLE, PROMO_CODE_*
POST/me/subscriptionuser, 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/canceluser (owner){reason?, note?}SubscriptionViewSUBSCRIPTION_NOT_FOUND, SUBSCRIPTION_NOT_OWNER, SUBSCRIPTION_CHANNEL_MISMATCH
POST/me/subscription/resumeuser (owner)—SubscriptionViewSUBSCRIPTION_INVALID_TRANSITION
PUT/me/subscription/payment-methoduser (owner){method}SubscriptionView (turns auto-renew on)SUBSCRIPTION_CHANNEL_MISMATCH
POST/me/subscription/payuser (owner), Idem—201 Checkout, a manual retry while past_due or graceSUBSCRIPTION_INVALID_TRANSITION, SUBSCRIPTION_PAYMENT_PENDING
POST/me/subscription/plan-change/previewuser (owner){planCode}{effect: immediate|period_end, charge, creditAfter, periodStart, periodEnd, targetPlanCode}SUBSCRIPTION_PLAN_UNCHANGED, PLAN_*
POST/me/subscription/plan-changeuser (owner), Idem{planCode}{quote, checkout: Checkout|null, subscription}as preview, plus SUBSCRIPTION_PAYMENT_PENDING
GET/me/subscription/chargesuser?cursor&limitpage of ChargeView, both paid by and paid for this person—
POST/me/subscription/promo-codes/validateuser (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/subscriptionstaff:users:read—same as GET /me/subscription—
  • SubscriptionView is {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.
  • Checkout is {charge: ChargeView, payment: {id, status, checkoutUrl}}. Open checkoutUrl when it's set.
  • ChargeView is {id, kind, status, channel, grossAmount, discountAmount, creditApplied, amount, serviceStart, serviceEnd, checkoutUrl, createdAt, settledAt}.
  • Entitlements is {canPlayFull, canDownload, adFree, lossless, listenTogether, isTrial, isPaid, planCode, maxSeats, assistantQuota}.

Seats (duo, family) ​

MethodPathAuthBodyResponseErrors
GET/me/subscription/seatsuser (owner)—{subscriptionId, capacity, addonSeats, maxAddonSeats, pendingAddonSeats, addonSeatPrice, seats: SeatView[]}SEAT_PLAN_HAS_NO_SEATS
POST/me/subscription/seatsuser (owner){userId}201 SeatView; the invitee is notifiedSEAT_SELF, SEAT_LIMIT_REACHED, SEAT_ALREADY_MEMBER, SEAT_INVITE_INVALID, USER_NOT_FOUND
DELETE/me/subscription/seats/:seatIduser (owner)—{status:"ok"}SEAT_NOT_FOUND
POST/me/subscription/seats/leaveuser (member)—{status:"ok"}SEAT_NOT_FOUND
POST/me/subscription/addon-seatsuser (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/removeuser (owner){quantity}seats view; takes effect at the next renewalVALIDATION_FAILED
GET/me/seat-invitesuser—[{id, subscriptionId, ownerUserId, planCode, planName, inviteExpiresAt}]—
POST/me/seat-invites/:seatId/acceptuser—SeatViewSEAT_INVITE_INVALID, SEAT_ALREADY_MEMBER, SEAT_LIMIT_REACHED
POST/me/seat-invites/:seatId/declineuser—{status:"ok"}SEAT_INVITE_INVALID
MethodPathAuthBodyResponseErrors
POST/me/subscription/gift-linksuser (recipient){planCode, currency, periods?, message?}201 {link, token, url}. The token is shown only oncePLAN_*
GET/me/subscription/gift-linksuser?cursor&limitpage of GiftLinkView—
DELETE/me/subscription/gift-links/:iduser—{status:"ok"}GIFT_LINK_NOT_FOUND, GIFT_LINK_CLOSED
GET/subscription-gifts/:tokenpublic (60/min per IP)—GiftLinkViewGIFT_LINK_NOT_FOUND, GIFT_LINK_CLOSED
POST/subscription-gifts/:token/checkoutuser (payer), Idem{method}201 CheckoutGIFT_SELF, GIFT_LINK_CLOSED
POST/subscription-giftsuser (payer), Idem{recipientUserId, planCode, currency, periods?, method, message?}201 CheckoutGIFT_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 ​

MethodPathAuthBodyResponseErrors
POST/me/subscription/store/appleuser (30/h){receipt}: a StoreKit 2 JWS transaction or a transaction IDGET /me/subscription shapeSTORE_RECEIPT_INVALID, STORE_PURCHASE_TAKEN, SUBSCRIPTION_ALREADY_ACTIVE, STORE_UNAVAILABLE
POST/me/subscription/store/googleuser (30/h){productId, purchaseToken}as aboveas above
POST/webhooks/subscriptions/appleApple signatureApp Store Server Notifications V2 {signedPayload}{status:"accepted"}STORE_NOTIFICATION_INVALID
POST/webhooks/subscriptions/google?token=…shared tokenPub/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) ​

MethodPathAuthBody / queryResponseErrors
GET/staff/promo-codesstaff:users:read?cursor&limit&campaignpage of StaffPromo—
POST/staff/promo-codesstaff: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 StaffPromoPROMO_CODE_TAKEN, PLAN_NOT_FOUND
PATCH/staff/promo-codes/:idstaff:settings:manageany field except code and discountStaffPromoNOT_FOUND
GET/staff/subscriptions/promo-codes/:idstaff:users:read?cursor&limit (redemptions){promo: StaffPromo (planIds scope, limits, redemptionCount), redemptions: page}NOT_FOUND
GET/staff/promo-codes/:id/redemptionsstaff:users:read?cursor&limitpage 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_ended uses subscription.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.

Plemuz API v2