Build subscription apps faster
Subscriptions on iOS and Android mean two billing systems, receipt handling, entitlement checks, and a way to see what actually happened when a purchase fails.
A subscription SDK and backend can take that plumbing off your plate so the app code focuses on showing products, completing a purchase, and unlocking the right content.
How the integration works
The flow has three steps, and each one has a clear owner.
- Configure products. In the dashboard, app store products are mapped to offerings and packages. This is the layer that decides which products the app can present together.
- Connect the SDK. The Purchases SDK is designed to be dropped into the app and supports the major platforms and frameworks, including iOS, Android, React Native, Flutter, and Unity, with first-class TypeScript support.
- Fetch, subscribe, unlock. The app fetches product information, makes a purchase, and then checks entitlement state to decide whether to unlock content. The supplied code tabs show each step in Swift-style calls.
Field and control map
The three code tabs correspond to three distinct jobs. Treat them as a sequence, not alternatives.
- Fetch offerings (control: Fetch offerings) calls
Purchases.shared.getOfferingsand readsofferings?.current?.availablePackagesto get the list of packages to display. - Make purchases (control: Make purchases) calls
Purchases.shared.purchase(package:)and returnstransaction,customerInfo,error, anduserCancelled. - Check subscription status (control: Check subscription status) calls
Purchases.shared.getCustomerInfoto read the latestcustomerInfo.
The unlock decision is made from customerInfo.entitlements["your_entitlement_id"]?.isActive == true. The entitlement ID is a placeholder that must be replaced with the real configured identifier; it is not a value to hardcode from this page.
Telling failures apart
The purchase callback returns four values, and they answer different questions:
userCancelledis true when the person backed out of the store sheet. That is not an error and usually should not show an error message.erroris non-nil when the purchase itself failed (network, store, or configuration). Surface it and log it.transactiondescribes what the store reported for this attempt.customerInfois the source of truth for access. Even a successful purchase only unlocks content when the entitlement is active.
A common mistake is to unlock on transaction != nil alone. Check the entitlement instead, and re-fetch customerInfo on launch and on resume so access reflects the latest state.
Debugging with confidence
Sandbox testing, detailed logs, and real-time debugging tools let you watch purchases and subscriptions at every step. Use sandbox accounts to exercise the purchase path before release, and read the logs when a purchase succeeds in the store but the entitlement does not activate. Logs and sandbox testing help you narrow down whether the issue sits in the app's fetch/purchase call, the product mapping in the dashboard, or the entitlement configuration.
REST API and webhooks
The source lists three server-side capabilities: full access to subscription data via the REST API, webhooks for real-time events, and the pieces needed to build custom integrations and backend workflows. A practical split is to use the API for reads and backfills — syncing entitlement state to your own database or reconciling purchases with an internal billing record — and to use webhooks for event-driven reactions such as triggering lifecycle emails when a renewal or cancellation arrives.
When a subscription SDK is the right call
Use this checklist before adopting a subscription SDK and backend:
- You ship on more than one store (App Store and Google Play) and want one entitlement model across both.
- You need server-side truth about subscription state, not just a client-side receipt check.
- You want webhooks to react to renewals, cancellations, and billing issues without polling.
- You are willing to map products to offerings in a dashboard rather than hardcode product IDs in the app.
- You can replace placeholder identifiers such as the entitlement ID with your own configured values.
If your app has a single product, a single platform, and no backend, direct StoreKit or Play Billing may be simpler. The trade-off is that you own receipt validation, renewal handling, and cross-platform consistency yourself.
Where to get help
The source points to a community forum for questions and answers, a space for sharing ideas and connecting with other developers, and a place to read the latest feature releases and updates. Documentation covers installation, the API reference, sample apps, and migration paths. Support response times and channel commitments are not asserted here; see the owner-input template below.
Plan, pricing, and support commitments
The following items require owner confirmation before publication and are not asserted here:
- Free tier limits and paid plan prices: {{OWNER_PLAN_PRICING}}
- Support response times and channels: {{OWNER_SUPPORT_COMMITMENT}}
- Community forum and feature-release channels: {{OWNER_COMMUNITY_CHANNELS}}
- Any guarantee about billing API changes or migration assistance: {{OWNER_GUARANTEE_TERMS}}
- Customer counts or adoption claims: {{OWNER_ADOPTION_FIGURES}}
- Testimonials and customer stories: {{OWNER_TESTIMONIALS}}
- Trial length and cancellation terms: {{OWNER_TRIAL_TERMS}}
Frequently asked questions
Should I unlock content when the purchase transaction succeeds?
No. Unlock only when the entitlement is active, for example customerInfo.entitlements["your_entitlement_id"]?.isActive == true. A transaction can succeed while the entitlement is not yet active, and a restored purchase has no new transaction at all.
How do I tell a user cancellation from a real error?
The purchase callback returns userCancelled separately from error. If userCancelled is true, the person dismissed the store sheet; do not show an error. If error is non-nil, the purchase failed and should be logged and surfaced.
Which platforms does the Purchases SDK support?
The SDK is described as supporting all major platforms and frameworks, with iOS, Android, React Native, Flutter, and Unity named explicitly, plus first-class TypeScript support.
When should I use the REST API versus webhooks?
Use the REST API when you need to read or backfill subscription data. Use webhooks when you need to react to events in real time, such as renewals or cancellations, without polling.