Introduction
In-app purchases (IAPs) are one of the most effective ways to monetize mobile applications, whether you’re offering premium features, virtual goods, or recurring subscriptions. Both Apple’s App Store and Google Play offer robust systems for integrating IAPs, but implementation must be done correctly to ensure a seamless user experience and store compliance.

In this guide, you’ll learn how to implement in-app purchases step by step for both iOS (StoreKit) and Android (Google Play Billing) platforms, covering everything from product setup to testing and validation.
What Are In-App Purchases?
In-app purchases allow users to buy digital products directly within your app. These products fall into four categories:
- Consumables: Used once and can be repurchased (e.g., game coins, hints).
- Non-consumables: Purchased once and do not expire (e.g., remove ads, unlock features).
- Auto-renewable subscriptions: Ongoing access to content or services (e.g., monthly membership).
- Non-renewing subscriptions: Time-limited access without auto-renewal (e.g., seasonal content).
Step 1: Decide What to Sell
Before coding, define the purpose of your in-app purchases:
- What features or content will be behind a paywall?
- Will users purchase one-time items or subscribe?
- What are the price points?
This clarity will guide how you configure products in the app stores and design your app’s user interface.
Step 2: Configure IAP Products in the App Stores
iOS (App Store Connect):

- Log in to App Store Connect.
- Go to My Apps > Your App > In-App Purchases.
- Click the + icon to create a new IAP.
- Select the product type (consumable, non-consumable, or subscription).
- Enter:
- Product ID (unique identifier)
- Reference name
- Localized display name and description
- Pricing and availability
- Save and submit for review.
Android (Google Play Console):
- Log in to Google Play Console.
- Go to Monetize > Products > In-app products.
- Click Create Product.
- Define:
- Product ID
- Product type
- Title and description
- Pricing
- Save and publish.
Note: Product IDs must match the values you use in your app’s source code.
Step 3: Integrate the In-App Billing Library
Android:

Add the Google Play Billing Library dependency in your app-level build.gradle
file:
gradleCopyEditdependencies {
implementation 'com.android.billingclient:billing:6.0.1'
}
iOS:
Use the built-in StoreKit framework. Import it into your Swift file:
swiftCopyEditimport StoreKit
Step 4: Fetch Available Products
Once the billing libraries are set up, fetch available products from the store.
Android (Kotlin Example):
kotlinCopyEditval skuList = listOf("premium_upgrade", "coin_pack")
val params = SkuDetailsParams.newBuilder()
.setSkusList(skuList)
.setType(BillingClient.SkuType.INAPP)
billingClient.querySkuDetailsAsync(params.build()) { result, skuDetailsList ->
// Display product details in your app UI
}
iOS (Swift Example):
swiftCopyEditlet productIDs: Set<String> = ["com.appname.feature1"]
let request = SKProductsRequest(productIdentifiers: productIDs)
request.delegate = self
request.start()
Step 5: Initiate the Purchase
Once the user selects a product, trigger the purchase flow.

Android:
kotlinCopyEditval billingFlowParams = BillingFlowParams.newBuilder()
.setSkuDetails(skuDetails)
.build()
billingClient.launchBillingFlow(activity, billingFlowParams)
iOS:
swiftCopyEditlet payment = SKPayment(product: selectedProduct)
SKPaymentQueue.default().add(payment)
Step 6: Handle Purchase Results
You must handle the response to determine whether the transaction was successful, failed, or canceled.
Android:
Implement PurchasesUpdatedListener
and check the purchase state:
kotlinCopyEditoverride fun onPurchasesUpdated(result: BillingResult, purchases: List<Purchase>?) {
if (result.responseCode == BillingClient.BillingResponseCode.OK && purchases != null) {
// Grant the item
}
}
iOS:
Implement SKPaymentTransactionObserver
and process the transaction state:
swiftCopyEditfunc paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
for transaction in transactions {
switch transaction.transactionState {
case .purchased:
// Unlock feature
SKPaymentQueue.default().finishTransaction(transaction)
case .failed:
SKPaymentQueue.default().finishTransaction(transaction)
default:
break
}
}
}
Step 7: Validate Purchases (Optional but Recommended)
Use server-side validation to confirm purchase authenticity. This is especially important for subscriptions or unlockable features.

- iOS: Send the receipt data to Apple’s verification endpoint.
- Android: Use Google Play Developer API to validate purchase tokens.
Step 8: Test In-App Purchases
iOS:
- Add sandbox testers in App Store Connect.
- Use TestFlight or the sandbox environment for testing.
Android:
- Add license testers in Google Play Console.
- Use internal testing tracks for real-time app and IAP testing.
Testing ensures that all edge cases, including refunds, cancellations, and expired subscriptions, are handled properly.
Step 9: Monitor and Optimise
After launch, monitor:
- Purchase conversion rates
- Refunds and failed transactions
- Subscription retention (if applicable)
Use analytics to improve pricing strategy and user engagement.
Conclusion
Adding in-app purchases is a foundational step in monetising mobile apps, but proper implementation is critical to delivering a smooth, secure user experience. By following this step-by-step setup for Android and iOS, you ensure your app complies with platform requirements while offering users a frictionless way to unlock value.

Whether you’re building your first app or scaling an existing one, integrating in-app purchases sets the stage for sustainable revenue and long-term growth.