/mobile-app-features

How to Add In-App Purchases to Your Mobile App

Learn how to easily add in-app purchases to your mobile app and boost revenue with our step-by-step guide.

Book a free  consultation
4.9
Clutch rating 🌟
600+
Happy partners
17+
Countries served
190+
Team members
Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

How to Add In-App Purchases to Your Mobile App

Implementing In-App Purchases: A Developer's Guide for Business Impact

 

Why In-App Purchases Matter

 

In-app purchases (IAPs) have become the backbone of mobile app monetization, offering a way to generate revenue without disrupting the user experience with ads or requiring upfront payment. When implemented thoughtfully, they can transform a free app into a sustainable business while enhancing user satisfaction.

 

Types of In-App Purchases You Can Offer

 

  • Consumable items: One-time use products that can be purchased repeatedly (extra lives, virtual currency, temporary power-ups)
  • Non-consumable items: Permanent features or content purchased once (ad removal, premium filters, additional app features)
  • Auto-renewable subscriptions: Ongoing access to content or services with automatic billing (monthly premium content, streaming services)
  • Non-renewing subscriptions: Fixed-term access without automatic renewal (seasonal passes, limited-time access)

 

Implementation Roadmap: iOS vs Android

 

Both platforms handle IAPs differently, so let's break down the implementation process for each:

 

Setting Up Your Products

 

  • iOS (App Store Connect): Create your products in App Store Connect before implementing them in code
  • Android (Google Play Console): Define your in-app products in the Play Console's "Monetize" section

 

For both platforms, you'll need to create unique product IDs (like "com.yourapp.premium.monthly") that you'll reference in your code.

 

iOS Implementation with StoreKit

 

Apple's StoreKit framework handles everything IAP-related on iOS. Here's how to implement it:

 

1. Basic Setup

 

import StoreKit

class IAPManager: NSObject {
    // Shared instance for singleton pattern
    static let shared = IAPManager()
    
    // Product identifiers
    let productIDs = ["com.yourapp.premium.monthly", "com.yourapp.removeads"]
    
    // Available products fetched from App Store
    var products = [SKProduct]()
    
    // Observer for tracking transactions
    private var purchaseObserver: Any?
    
    override init() {
        super.init()
        // Setup transaction observer
        purchaseObserver = SKPaymentQueue.default().add(self)
    }
}

 

2. Fetch Available Products

 

func fetchProducts() {
    let request = SKProductsRequest(productIdentifiers: Set(productIDs))
    request.delegate = self
    request.start()
}

// Delegate method to receive products
extension IAPManager: SKProductsRequestDelegate {
    func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
        self.products = response.products
        
        // Handle invalid product identifiers
        if !response.invalidProductIdentifiers.isEmpty {
            print("Invalid product IDs: \(response.invalidProductIdentifiers)")
        }
    }
}

 

3. Make a Purchase

 

func purchase(product: SKProduct) {
    // Check if user can make payments
    guard SKPaymentQueue.canMakePayments() else {
        // Handle case where user can't make payments
        return
    }
    
    let payment = SKPayment(product: product)
    SKPaymentQueue.default().add(payment)
}

 

Android Implementation with Google Play Billing Library

 

1. Setup Dependencies

 

Add the Google Play Billing Library to your app's build.gradle:

dependencies {
    implementation 'com.android.billingclient:billing:5.0.0'
}

 

2. Initialize the Billing Client

 

class BillingManager(private val activity: Activity) {
    private lateinit var billingClient: BillingClient
    
    init {
        setupBillingClient()
    }
    
    private fun setupBillingClient() {
        billingClient = BillingClient.newBuilder(activity)
            .setListener { billingResult, purchases ->
                // Process purchases here
                if (billingResult.responseCode == BillingClient.BillingResponseCode.OK && purchases != null) {
                    for (purchase in purchases) {
                        handlePurchase(purchase)
                    }
                }
            }
            .enablePendingPurchases()
            .build()
            
        // Connect to Google Play
        billingClient.startConnection(object : BillingClientStateListener {
            override fun onBillingSetupFinished(billingResult: BillingResult) {
                if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
                    // The billing client is ready. You can query purchases here.
                    queryAvailableProducts()
                }
            }
            
            override fun onBillingServiceDisconnected() {
                // Try to reconnect
            }
        })
    }
}

 

3. Query Products and Make Purchases

 

private fun queryAvailableProducts() {
    val params = QueryProductDetailsParams.newBuilder()
        .setProductList(
            listOf(
                QueryProductDetailsParams.Product.newBuilder()
                    .setProductId("premium_subscription")
                    .setProductType(BillingClient.ProductType.SUBS)
                    .build(),
                QueryProductDetailsParams.Product.newBuilder()
                    .setProductId("remove_ads")
                    .setProductType(BillingClient.ProductType.INAPP)
                    .build()
            )
        )
        .build()
        
    billingClient.queryProductDetailsAsync(params) { billingResult, productDetailsList ->
        // Store product details for later use
    }
}

fun purchase(productDetails: ProductDetails) {
    val productDetailsParamsList = listOf(
        BillingFlowParams.ProductDetailsParams.newBuilder()
            .setProductDetails(productDetails)
            .build()
    )

    val billingFlowParams = BillingFlowParams.newBuilder()
        .setProductDetailsParamsList(productDetailsParamsList)
        .build()
        
    billingClient.launchBillingFlow(activity, billingFlowParams)
}

 

Cross-Platform Implementation with React Native

 

If you're building with React Native, several libraries simplify IAP implementation across both platforms:

 

// Using react-native-iap
import { initConnection, getProducts, requestPurchase } from 'react-native-iap';

// Product IDs for both platforms
const productIds = Platform.select({
  ios: ['com.yourapp.premium'],
  android: ['premium_subscription']
});

// Initialize connection to store
await initConnection();

// Get product details
const products = await getProducts({ productIds });

// Purchase a product
try {
  await requestPurchase({ 
    sku: products[0].productId,
    // For subscriptions on Android:
    // andDangerouslyFinishTransactionAutomaticallyIOS: false
  });
  // Handle successful purchase
} catch (error) {
  // Handle purchase error
}

 

Receipt Validation: The Critical Security Step

 

Never trust the client for purchase verification. Always validate receipts on your server to prevent fraud.

 

  • For iOS: Send the receipt data to your server, which forwards it to Apple's verification endpoint
  • For Android: Use the Google Play Developer API to verify purchases server-side

 

Here's a simplified server-side validation example:

// Server-side receipt validation (Node.js example)
async function verifyAppleReceipt(receiptData) {
  const endpoint = process.env.NODE_ENV === 'production'
    ? 'https://buy.itunes.apple.com/verifyReceipt'
    : 'https://sandbox.itunes.apple.com/verifyReceipt';
    
  const response = await fetch(endpoint, {
    method: 'POST',
    body: JSON.stringify({
      'receipt-data': receiptData,
      'password': process.env.SHARED_SECRET // Your App-Specific Shared Secret
    })
  });
  
  const validation = await response.json();
  
  // Check status and process receipt data
  if (validation.status === 0) {
    // Valid receipt - update user entitlements in your database
    return true;
  }
  
  return false;
}

 

Testing Your In-App Purchases

 

  • iOS: Use sandbox testing accounts in App Store Connect to test purchases without real money
  • Android: Use test accounts and Google's test tracks to validate your implementation

 

Common Pitfalls to Avoid

 

  • Incomplete transaction handling: Always finalize transactions to prevent them from being reprocessed
  • Poor receipt validation: Client-side only validation is like leaving your store unlocked
  • Missing restore functionality: Users expect to recover their purchases when they reinstall your app
  • Unclear pricing or benefits: Make sure users know exactly what they're getting before they pay
  • Neglecting subscription management: Provide clear ways for users to manage or cancel subscriptions

 

Beyond Implementation: The Business Side

 

While the technical implementation is crucial, successful IAPs also depend on:

 

  • Pricing strategy: Too expensive and no one buys; too cheap and you leave money on the table
  • Value proposition: Purchases should solve real user problems or add meaningful value
  • Conversion optimization: A/B test different pricing points and presentation

 

Final Thoughts: IAPs as a User Experience

 

The most successful apps treat IAPs not as mere money-makers but as extensions of the user experience. When users make a purchase, they're investing in your product—make sure it feels worthwhile.

 

Remember that a thoughtfully implemented IAP system should be:

  • Transparent about what users get
  • Secure in handling financial transactions
  • Reliable in delivering purchased content
  • Respectful of user choices (including the choice not to purchase)

 

When implemented well, in-app purchases create that rare win-win: users get enhanced value, and your app gets the revenue it needs to thrive.

Ship In-App Purchases 10x Faster with RapidDev

Connect with our team to unlock the full potential of code solutions with a no-commitment consultation!

Book a Free Consultation

Top 3 Mobile App In-App Purchases Usecases

Explore the top 3 in-app purchase use cases to boost your mobile app’s revenue and user engagement.

 

Premium Content Unlock

 

A straightforward value exchange where users pay once to access exclusive content or features within your app. This model creates a clear separation between free and premium tiers without recurring billing complexity.

 
  • Business value: Creates immediate revenue while maintaining a free entry point that encourages initial downloads. Premium unlocks typically have 2-5% conversion rates from free users when properly implemented.
  • Implementation consideration: Content gating requires thoughtful UX design to showcase premium value without frustrating free users. The premium offering must deliver enough perceived value to justify the one-time payment.

 

Consumable Virtual Goods

 

Digital items users purchase and "use up" within your app, requiring repurchase when depleted. Examples include in-game currency, extra lives, boosters, or temporary power-ups that enhance the user experience.

 
  • Business value: Creates sustainable recurring revenue streams with higher lifetime value than one-time purchases. Data shows users who make even small consumable purchases are 4-7x more likely to remain active users after 30 days.
  • Implementation consideration: Requires robust server-side validation to prevent manipulation and careful economy balancing to maintain perceived value without creating "pay-to-win" dynamics that alienate non-paying users.

 

Subscription Services

 

Recurring payment model granting users continuous access to premium features, content updates, or services for a fixed period (typically monthly or annually), automatically renewing until canceled.

 
  • Business value: Provides predictable revenue forecasting and higher customer lifetime value than other IAP models. Successful subscription apps see 80%+ of revenue from subscriptions, with annual plans reducing churn by approximately 30% compared to monthly options.
  • Implementation consideration: Requires sophisticated user retention strategies, clear cancellation flows to avoid negative reviews, and compelling ongoing value delivery to justify continued payments. Most successful when offering a free trial period with conversion rates typically between 15-60% depending on price point and value proposition.


Recognized by the best

Trusted by 600+ businesses globally

From startups to enterprises and everything in between, see for yourself our incredible impact.

RapidDev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with.

They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

Arkady
CPO, Praction
Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost.

He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Donald Muir
Co-Founder, Arc
RapidDev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space.

They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Mat Westergreen-Thorne
Co-CEO, Grantify
RapidDev is an excellent developer for custom-code solutions.

We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Emmanuel Brown
Co-Founder, Church Real Estate Marketplace
Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 

This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Samantha Fekete
Production Manager, Media Production Company
The pSEO strategy executed by RapidDev is clearly driving meaningful results.

Working with RapidDev has delivered measurable, year-over-year growth. Comparing the same period, clicks increased by 129%, impressions grew by 196%, and average position improved by 14.6%. Most importantly, qualified contact form submissions rose 350%, excluding spam.

Appreciation as well to Matt Graham for championing the collaboration!

Michael W. Hammond
Principal Owner, OCD Tech

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We’ll discuss your project and provide a custom quote at no cost.Â