We help businesses bring their ideas to life with high-quality software solutions.

Contact Info

405-406, Elite Business Park, Opp. Shapath Hexa, Sola, Ahmedabad, Gujarat - 380060.

HR

hr@iqinfinite.in
+91 81601 25447

Sales

info@iqinfinite.in
+91 96649 54715

Follow Us

Building a Production-Grade Subscription System for Apple and Google

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

Subscriptions are not just about charging users monthly. A robust system must handle:
  • Purchase verification
  • Subscription lifecycle management
  • Refunds and revocations
  • Grace periods and payment retries
  • Real-time status updates
  • Fraud prevention
  • Cross-device entitlement syncing
Without proper backend infrastructure, apps risk revenue leakage, inconsistent user access and compliance issues with store policies.

Understanding Platform Billing Systems

Before designing the backend, developers need to understand how Apple and Google handle subscription billing and lifecycle events.

Apple In-App Subscriptions

Apple subscriptions operate through StoreKit and the App Store billing system.

Key features include:
  • Auto-renewable subscriptions
  • Introductory offers and trials
  • Family sharing
  • Refund management
  • Server-to-server lifecycle notifications
With StoreKit 2, Apple introduced modern APIs based on Swift concurrency, making purchase management and subscription verification simpler and more secure.

Major improvements include:
  • Local transaction verification using JSON Web Signature (JWS)
  • Simplified subscription status retrieval
  • Built-in APIs to manage refunds and entitlements
This modern architecture reduces reliance on older receipt verification endpoints and improves performance at scale.

Google Play Subscriptions

On Android, subscriptions are managed through the Google Play Billing Library. A strong Android subscription implementation ensures compliance and scalability.

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
These updates enhance flexibility in monetization and help developers manage subscriptions more efficiently.

To maintain accuracy, developers must verify Google Play subscription server responses using backend validation.

Modern Subscription Architecture

A production-grade system typically consists of three layers:
Mobile App (iOS / Android)
        ↓
App Store / Google Play
        ↓
Backend Subscription Service
        ↓
Database + Entitlement Engine

1. Mobile App Layer

The app initiates purchase flows using platform SDKs.

Example:

iOS
    • StoreKit 2
    • Transaction verification
    • Subscription status query

Android
    • Play Billing Library
    • Purchase token retrieval
    • Purchase acknowledgement
The mobile app should never directly grant entitlements without server verification.

2. Backend Subscription Service

The backend is the single source of truth for subscriptions.

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
The backend typically communicates with the Apple App Store Server API and the Google Play Developer API.

Real-Time Subscription Lifecycle Events

Real-time notifications are essential for maintaining accurate subscription status.

Apple Server Notifications

Apple provides App Store Server Notifications V2.

These notifications inform your backend when:
  • A subscription renews
  • A refund occurs
  • A subscription expires
  • Billing fails
  • A user cancels
The notification payload includes signed transaction data so developers can process events without additional verification calls.

Recent updates also introduced new notification types like ONE_TIME_CHARGE for additional purchase tracking.

Google Real-Time Developer Notifications (RTDN)

Google Play uses Real-Time Developer Notifications.

Events include:
  • Subscription purchased
  • Renewal
  • Cancellation
  • Payment failure
  • Account hold
  • Subscription pause
After receiving a notification, the backend should call the Google Play Developer API using the purchase token to confirm the latest subscription status.

Subscription Lifecycle Management

A subscription typically progresses through several states:
  • 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
Your backend should track these states and update user entitlements in real time.

Handling Upgrades, Downgrades and Plan Changes

A robust subscription system must support plan transitions, such as:
  • Monthly → Yearly upgrades
  • Premium → Pro tier changes
  • Pricing updates or migrations
On Google Play, subscription transitions are tracked using purchaseToken and linkedPurchaseToken.

On Apple, plan changes are linked through the originalTransactionId.

This ensures subscription continuity when users switch plans.

Refunds and Chargebacks

Refunds may occur due to:

    • 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

A production-grade subscription system should follow these security principles:

1. Server-side validation

Never rely solely on client purchase data.

2. Signature verification

Verify transactions using JWS signatures for Apple receipts.

3. Idempotent processing

Ensure events are processed only once to prevent duplication.

4. Secure webhook endpoints

Validate incoming store notifications.

5. Token validation

Always verify token expiration and authenticity.

Scalability Considerations

Applications with large subscriber bases must handle high billing traffic reliably.

Recommended architecture patterns include:
  • Event-driven systems
  • Message queues (Kafka / PubSub)
  • Stateless microservices
  • Distributed caching
  • Subscription event logs
These practices ensure reliability during peak billing cycles.

Cross-Platform Entitlement Strategy

If your app runs across multiple platforms such as iOS, Android, Web or Smart TVs, entitlements should be managed centrally in your backend.

Typical architecture:
User Account
     ↓
Subscription Status
     ↓
Entitlement Engine
     ↓
Feature Access
This enables users to access premium features across devices with a single subscription.

Common Developer Mistakes

Some common pitfalls when implementing subscription systems include:
  • Trusting client-side validation
  • Ignoring server notifications
  • Missing billing edge cases
  • Failing to handle refunds properly
  • Not upgrading deprecated billing libraries
For example, Google Play frequently deprecates older billing versions, requiring developers to migrate to newer libraries.

Future Trends in Subscription Monetization

The subscription ecosystem continues to evolve. Key trends include:
  • External payment options in select regions
  • Personalized subscription offers and win-back pricing
  • Cross-device subscription experiences
  • Reduced platform fees and developer incentive programs
These changes are shaping the next generation of subscription-based apps.

Conclusion

Building a production-grade subscription system requires more than integrating a billing SDK.

A modern architecture must support:
  • Secure transaction verification
  • Real-time lifecycle tracking
  • Cross-platform entitlements
  • Refund management
  • Scalable backend infrastructure
By combining StoreKit 2, Google Play Billing, real-time notifications and a robust backend, developers can build subscription systems that are secure, scalable and ready for millions of users.
Back to all Articles