How to Implement In-App Purchases: The Comprehensive 2026 Developer Guide
Back to Blog
TutorialsIn-App PurchasesStoreKit 2Google Play Billing

How to Implement In-App Purchases: The Comprehensive 2026 Developer Guide

Master the complexities of mobile monetization. This deep-dive covers StoreKit 2, Google Play Billing 7.0, and secure server-side validation to help you build a robust IAP system.

March 16, 202615 min read

In 2026, the global mobile app market is projected to generate over $700 billion in revenue, with In-App Purchases (IAP) accounting for nearly 80% of that figure. For developers and technical stakeholders, implementing a robust, secure, and scalable IAP system is no longer just a 'feature'—it is the lifeblood of the business.

However, building an IAP system is notoriously difficult. Between handling Apple's StoreKit 2, Google's ever-evolving Billing Library, managing cross-platform subscription states, and defending against receipt fraud, many teams find themselves bogged down in technical debt. At Increments Inc., we have spent 14+ years helping global brands like Freeletics and Abwaab navigate these waters.

Whether you are building a fitness app, an EdTech platform, or a SaaS tool, this guide will walk you through the architecture, implementation, and security protocols required to implement in-app purchases effectively.


1. Understanding the IAP Landscape in 2026

Before writing a single line of code, you must understand the rules of the game. In 2026, the duopoly of Apple and Google has been slightly disrupted by regulations like the EU's Digital Markets Act (DMA), allowing for alternative payment processors in certain regions. However, for most global apps, the native App Store and Google Play billing systems remain the standard due to their trust and ease of use.

Types of In-App Purchases

There are four primary categories of IAPs you need to support:

  1. Consumables: Items used once (e.g., game currency, 'hints' in an EdTech app).
  2. Non-Consumables: Permanent features (e.g., 'Pro' version unlock, ad-removal).
  3. Auto-Renewable Subscriptions: Recurring revenue models (e.g., monthly access to a library).
  4. Non-Renewing Subscriptions: Access for a fixed duration that does not automatically renew.

The Commission Structure

While the standard remains 30%, both platforms offer a 15% rate for small businesses (earning under $1M/year) and for subscriptions after the first year.

Pro-tip: If you're unsure how to structure your monetization strategy, Increments Inc. offers a free AI-powered SRS document that includes a detailed technical breakdown of the best revenue models for your specific niche.


2. High-Level Architecture: The 'Secure' Way

A common mistake junior developers make is trusting the client-side app to confirm a purchase. Never rely solely on the client. In 2026, client-side 'cracks' and proxy tools are more sophisticated than ever.

The Distributed Architecture Diagram

+------------+       1. Request Purchase      +-----------------+
|   Mobile   | -----------------------------> |  App Store /    |
|    App     | <----------------------------- |  Google Play    |
+------------+       2. Signed Transaction    +-----------------+
      |                                               ^
      | 3. Send Signed Data                           |
      v                                               | 4. Verify (Server-to-Server)
+------------+                                        |
|  Your      | ---------------------------------------+
|  Backend   | 
+------------+       5. Grant Access & Store in DB

Key Components:

  • The Client: Initiates the UI, triggers the platform-native payment sheet, and receives the cryptographically signed receipt/transaction.
  • The Store (Apple/Google): Processes the credit card, handles fraud detection, and issues the signed transaction.
  • Your Backend: Receives the transaction from the client, verifies it directly with the Store's API, and updates the user's entitlements in your database.

3. Implementing IAP on iOS (StoreKit 2)

Apple's StoreKit 2 (introduced in iOS 15 and refined through 2026) is a Swift-concurrency-first API. It significantly simplifies the process compared to the old SKPaymentQueue.

Step 1: Fetching Products

import StoreKit

func fetchProducts() async throws -> [Product] {
    let productIds = ["com.increments.monthly_pro", "com.increments.yearly_pro"]
    let products = try await Product.products(for: productIds)
    return products
}

Step 2: Handling the Purchase

func purchase(product: Product) async throws {
    let result = try await product.purchase()
    
    switch result {
    case .success(let verification):
        // Check if the transaction is verified by Apple
        let transaction = try checkVerified(verification)
        
        // Send the transaction.jwsRepresentation to your backend
        await sendToBackend(jws: transaction.jwsRepresentation)
        
        // Always finish the transaction
        await transaction.finish()
        
    case .userCancelled, .pending:
        break
    default:
        break
    }
}

Step 3: Transaction Verification

StoreKit 2 provides transactions in JWS (JSON Web Signature) format. Your backend should verify the signature using Apple's public keys to ensure the data hasn't been tampered with.


4. Implementing IAP on Android (Google Play Billing 7.0)

Google's Billing Library has moved toward a more modular approach. By 2026, version 7.0 is the standard, focusing on multi-quantity purchases and improved subscription management.

Step 1: Initialize BillingClient

val billingClient = BillingClient.newBuilder(context)
    .setListener(purchasesUpdatedListener)
    .enablePendingPurchases()
    .build()

billingClient.startConnection(object : BillingClientStateListener {
    override fun onBillingSetupFinished(billingResult: BillingResult) {
        if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
            // The BillingClient is ready. You can query purchases here.
        }
    }
})

Step 2: Launching the Flow

val productList = listOf(
    QueryProductDetailsParams.Product.newBuilder()
        .setProductId("premium_sub")
        .setProductType(BillingClient.ProductType.SUBS)
        .build()
)

val params = QueryProductDetailsParams.newBuilder().setProductList(productList).build()
billingClient.queryProductDetailsAsync(params) { billingResult, productDetailsList ->
    val productDetails = productDetailsList.firstOrNull() ?: return@queryProductDetailsAsync
    
    val flowParams = BillingFlowParams.newBuilder()
        .setProductDetailsParamsList(listOf(
            BillingFlowParams.ProductDetailsParams.newBuilder()
                .setProductDetails(productDetails)
                .build()
        ))
        .build()
    
    billingClient.launchBillingFlow(activity, flowParams)
}

5. Server-Side Validation: The Gold Standard

You should never unlock features based only on a client-side callback. Malicious users can easily spoof a 'success' response on rooted or jailbroken devices.

Verification Strategy Comparison

Feature Client-Only (Weak) Server-Side Validation (Strong)
Security Low (Easily bypassed) High (Cryptographically verified)
Cross-Platform Sync Impossible Easy (Centralized DB)
Refund Handling Manual/Late Automatic via Webhooks
Analytics Accuracy Poor (Duplicate events) High (Single source of truth)
Grace Periods Hard to manage Controlled via Backend logic

The Backend Workflow

  1. Receive JWS/Token: The app sends the receipt string to your /verify-purchase endpoint.
  2. Verify with Store: Your backend calls Apple's App Store Server API or Google's Publisher API.
  3. Check Entitlements: Verify that the product ID matches what the user claims to have bought.
  4. Update Database: Set is_premium = true or increment the coin_balance.
  5. Listen for Webhooks: This is critical for subscriptions. If a user cancels or their payment fails, the store will send a webhook (App Store Server Notifications V2) to your server so you can revoke access immediately.

Building this infrastructure from scratch can take months. If you're looking to launch faster, Increments Inc. provides a $5,000 technical audit where we review your billing architecture for security flaws and performance bottlenecks at no cost to you.


6. Handling Edge Cases and 'The Dreaded States'

Implementing IAP is 20% 'happy path' and 80% edge cases. Your system must handle the following states gracefully:

A. Subscription Lifecycle

  • Grace Period: The user's payment failed, but Apple/Google allows them to keep access for 6–16 days while they fix the issue.
  • Account Hold: The grace period ended, and the user still hasn't paid. Access should be restricted, but the subscription isn't 'canceled' yet.
  • Price Increases: Both platforms now allow for 'automatic' price increases under certain conditions, but you must still handle the logic for users who opt-out.

B. Refunds and Revocations

Users can request refunds directly from Apple or Google without your intervention. Without Server-to-Server (S2S) notifications, you might continue providing service for a purchase that has been refunded.

C. Family Sharing

If your app supports Family Sharing, one purchase can belong to multiple Apple IDs. Your backend must link these transactions to a single subscription record while allowing multiple app-level accounts to benefit.


7. To Build or To Buy? (RevenueCat vs. Custom)

Many teams debate whether to build their own IAP backend or use a service like RevenueCat, Adapty, or Glassfy.

Feature Custom Build RevenueCat / Third-Party
Upfront Cost High (Engineering hours) Low (Monthly fee)
Maintenance High (API updates yearly) Low (Abstracted by SDK)
Data Privacy Full Control Third-party data sharing
Time to Market 4–8 Weeks 1–2 Weeks
Platform Support iOS/Android/Web separately Unified API

Recommendation: For startups and MVPs, use a third-party service. For enterprise-scale apps with strict data privacy requirements (like FinTech or HealthTech), a custom-built solution is often better to avoid vendor lock-in and long-term costs.


8. Compliance, Taxes, and Global Markets

Implementing IAP isn't just a technical challenge; it's a financial one.

  • Taxes (VAT/GST): Apple and Google handle most sales taxes for you, but you are still responsible for reporting income in your home jurisdiction.
  • Privacy (GDPR/CCPA): Ensure you aren't sending PII (Personally Identifiable Information) to the stores unless necessary.
  • App Store Review Guidelines: Specifically, Guideline 3.1.1. If you try to bypass the IAP system for digital goods, your app will be rejected.

Key Takeaways

  • Client-side is for UI, Backend is for Truth: Always verify transactions server-side using JWS (Apple) or the Publisher API (Google).
  • Use Modern SDKs: Stick to StoreKit 2 and Google Play Billing 7.0 to avoid deprecated methods and security holes.
  • Implement Webhooks Early: You cannot manage subscription lifecycles effectively without S2S notifications.
  • Prepare for Edge Cases: Build logic for refunds, grace periods, and family sharing from day one.
  • Don't Reinvent the Wheel: Unless you have specific enterprise needs, consider IAP management platforms to save months of development time.

How Increments Inc. Can Help

Implementing in-app purchases is a high-stakes endeavor. A single bug in your billing logic can lead to thousands of dollars in lost revenue or, worse, a wave of negative reviews that kill your app's ranking.

At Increments Inc., we specialize in high-performance mobile and web engineering. We've built complex monetization systems for global clients, ensuring they are secure, scalable, and compliant with the latest 2026 standards.

Ready to monetize your app the right way?

  1. Get a Free AI-Powered SRS: We'll generate a comprehensive, IEEE 830-standard Software Requirements Specification for your project—absolutely free.
  2. Claim Your $5,000 Technical Audit: If you have an existing app, our senior engineers will perform a deep-dive audit of your architecture and security, free of charge.

Start Your Project with Increments Inc. Today

Alternatively, reach out to us directly on WhatsApp to discuss your monetization strategy with our engineering leads.

Topics

In-App PurchasesStoreKit 2Google Play BillingApp MonetizationMobile EngineeringSubscription Management

Written by

II

Increments Inc.

Engineering Team

Want to build something?

Get a free consultation and technical audit worth $5,000. We'll help you build your next successful product.

  • Free $5,000 technical audit
  • No upfront payment required
  • 14+ years of experience