Building a Production-Grade Subscription System for Apple and Google
Subscription-based monetization has become the dominant revenue model for modern mobile apps. From productivity tools and streaming services to AI-powered applications, recurring billing drives predictable revenue and long-term customer value.
Building in app subscription iOS and Android systems requires a deep understanding of both ecosystems and a well-architected backend.
However, implementing subscriptions across both Apple and Google ecosystems is not trivial. A production-grade subscription system must handle secure transactions, server validation, real-time lifecycle events, refunds, upgrades, downgrades and cross-platform entitlement management.
Why Subscription Infrastructure Matters
- Purchase verification
- Subscription lifecycle management
- Refunds and revocations
- Grace periods and payment retries
- Real-time status updates
- Fraud prevention
- Cross-device entitlement syncing
Understanding Platform Billing Systems
Apple In-App Subscriptions
Key features include:
- Auto-renewable subscriptions
- Introductory offers and trials
- Family sharing
- Refund management
- Server-to-server lifecycle notifications
Major improvements include:
- Local transaction verification using JSON Web Signature (JWS)
- Simplified subscription status retrieval
- Built-in APIs to manage refunds and entitlements
Google Play Subscriptions
Google frequently updates the billing framework and apps must migrate to newer versions to remain compliant.
Recent changes include:
- Play Billing Library 8.x improvements
- Multiple purchase options for one-time products
- Support for external payment programs
- Subscription suspension state tracking
- Improved product query APIs
To maintain accuracy, developers must verify Google Play subscription server responses using backend validation.
Modern Subscription Architecture
Mobile App (iOS / Android)
↓
App Store / Google Play
↓
Backend Subscription Service
↓
Database + Entitlement Engine
1. Mobile App Layer
Example:
iOS
• StoreKit 2
• Transaction verification
• Subscription status query
Android
• Play Billing Library
• Purchase token retrieval
• Purchase acknowledgement
2. Backend Subscription Service
Responsibilities include:
- Verifying purchase receipts
- Tracking subscription states
- Handling upgrades and downgrades
- Granting entitlements
- Syncing across devices (subscription sync iOS Android)
- Managing refunds and cancellations
Real-Time Subscription Lifecycle Events
Apple Server Notifications
These notifications inform your backend when:
- A subscription renews
- A refund occurs
- A subscription expires
- Billing fails
- A user cancels
Recent updates also introduced new notification types like ONE_TIME_CHARGE for additional purchase tracking.
Google Real-Time Developer Notifications (RTDN)
Events include:
- Subscription purchased
- Renewal
- Cancellation
- Payment failure
- Account hold
- Subscription pause
Subscription Lifecycle Management
- Active - The user has access to premium features
- Grace Period - Temporary payment retry window after a failed charge
- On Hold - Access is restricted due to payment failure
- Expired - The subscription has ended
- Cancelled - The user has disabled auto-renewal
Handling Upgrades, Downgrades and Plan Changes
- Monthly → Yearly upgrades
- Premium → Pro tier changes
- Pricing updates or migrations
purchaseToken and linkedPurchaseToken.On Apple, plan changes are linked through the
originalTransactionId.This ensures subscription continuity when users switch plans.
Refunds and Chargebacks
• Customer complaints
• Billing errors
• Regulatory policies
Apple recently enhanced refund handling by introducing:
• Prorated refunds
•
refundPercentage data• Revocation types
These improvements allow developers to manage refunds more accurately in subscription systems.
Security Best Practices
1. Server-side validation
2. Signature verification
3. Idempotent processing
4. Secure webhook endpoints
5. Token validation
Scalability Considerations
Recommended architecture patterns include:
- Event-driven systems
- Message queues (Kafka / PubSub)
- Stateless microservices
- Distributed caching
- Subscription event logs
Cross-Platform Entitlement Strategy
Typical architecture:
User Account
↓
Subscription Status
↓
Entitlement Engine
↓
Feature Access
Common Developer Mistakes
- Trusting client-side validation
- Ignoring server notifications
- Missing billing edge cases
- Failing to handle refunds properly
- Not upgrading deprecated billing libraries
Future Trends in Subscription Monetization
- External payment options in select regions
- Personalized subscription offers and win-back pricing
- Cross-device subscription experiences
- Reduced platform fees and developer incentive programs
Conclusion
A modern architecture must support:
- Secure transaction verification
- Real-time lifecycle tracking
- Cross-platform entitlements
- Refund management
- Scalable backend infrastructure