Home โ€บ Blog โ€บ In-app purchase implementation guide
๐Ÿ’ณ Guide ยท Monetization

In-app purchase implementation: a guide for mobile games

Selling a pack of coins looks like one button. Behind it are two store systems with different rules, purchases that can be interrupted, refunded or pending, and fraud that targets any game with a shop. This guide explains how in-app purchases work on iOS and Android and how to implement them so players get what they paid for and you get paid.

The short answer

Implement purchases as a flow with a server in the middle: fetch products from the store, start the purchase, validate the resulting transaction on your server, grant the item, then tell the store the transaction is complete. Handle interrupted, pending and refunded purchases, offer restore for permanent items, and test with the stores' sandbox tools. Skipping server validation is the most expensive shortcut in mobile games.

Product types

TypeExamplesBehaviour
ConsumableCoins, gems, lives, boostersBought repeatedly, used up
Non-consumableRemove ads, unlock a character, premium upgradeBought once, owned permanently, must be restorable
Auto-renewing subscriptionVIP membership, monthly passRenews until cancelled, has states such as grace period
Non-renewing or prepaidSeason pass for a fixed periodExpires, does not renew automatically

Apple and Google use slightly different names, but the categories match. Decide the type carefully, because it determines restore behaviour and how the stores treat refunds.

The purchase flow

  1. Configure products in App Store Connect and the Play Console with identifiers and price tiers.
  2. Fetch products at runtime. Always show the price string the store returns, which is localised with the right currency and tax. Never hard-code prices.
  3. Start the purchase when the player taps buy. The store shows its own payment sheet.
  4. Receive the transaction. It may succeed, fail, be cancelled or be pending.
  5. Validate on your server. Send the transaction data to your backend, which checks it with the store's server API.
  6. Grant the item in the player's server-side inventory.
  7. Finish the transaction. On iOS, finish it. On Android, consume or acknowledge it. Google refunds purchases that are not acknowledged within three days.
  8. Confirm to the player with a clear success state.

Do steps six and seven in that order. If you finish first and the grant fails, the player has paid for nothing.

Why server validation matters

Without it, a modified app or a fake receipt can tell your game that a purchase happened. With it, your server asks the store directly whether the transaction is real, whether it has been used before and whether it belongs to this product. Combine it with:

  • A server-held inventory, so currency is not just a number on the phone.
  • A record of processed transaction identifiers to block replay.
  • Store server notifications, which tell your backend about refunds, renewals and cancellations as they happen.

A small managed backend is enough. See Firebase vs PlayFab vs custom backend. Even single-player games benefit from validating purchases of high-value items.

States you must handle

SituationWhat to do
App closed during purchaseOn next launch, read unfinished transactions and complete the grant
Pending paymentShow a pending state and grant only when the store confirms
Ask to Buy or family approvalWait for the deferred transaction to resolve
Network loss after paymentRetry validation, never lose the transaction
Refund or chargebackReceive the notification and decide whether to remove the item
Subscription expiry or billing retryFollow store status, including grace periods
Reinstall or new deviceRestore non-consumables and subscriptions

Most support tickets about purchases come from the first four rows.

Restore purchases

Apple requires a way to restore non-consumable purchases and subscriptions. Add a visible restore button in the shop or settings. On Android, query existing purchases at launch. For consumables, the only reliable protection is an account system with server-held balances, so progress survives a new phone. See cross-play and cross-progression.

Engine tools

Unity's In-App Purchasing package wraps StoreKit and Google Play Billing behind one interface, which saves duplicate work, and Unreal has equivalent online subsystem support. Cross-platform subscription services add dashboards, validation and analytics. Wrappers do not remove the need to understand the flow, especially for pending and restored transactions. Keep the store libraries current, because the stores retire old billing versions on a schedule, a routine item in game maintenance cost.

Store rules to know

  • Digital goods used inside the app must generally use the store's purchase system, with exceptions that vary by region and are changing. See Google Play fees in 2026.
  • Prices and what the player receives must be clear before purchase.
  • Randomized items must disclose odds.
  • Apps for children have stricter rules, including purchase gates. See rules for kids games.
  • Subscriptions need clear terms, renewal information and an easy path to manage or cancel.

Rejections for purchase problems are common, as listed in our submission checklist.

Shop design that respects players

  • Show value clearly: quantity, bonus and price.
  • Offer a low-priced first purchase.
  • Avoid confusing layered currencies.
  • Never interrupt play with a purchase prompt at a moment of frustration that the game itself engineered.
  • Confirm large purchases.

Long-term revenue comes from players who trust the shop. The underlying structure is covered in game economy design and battle pass design.

Testing

  1. Sandbox and test accounts. Apple provides sandbox testers and local StoreKit testing. Google provides licence testers and test tracks.
  2. Every product on both platforms.
  3. Interruptions. Kill the app mid-purchase, turn off the network, switch accounts.
  4. Pending and declined payments.
  5. Restore on a clean install.
  6. Refund handling through server notifications.
  7. Subscriptions through renewal, expiry and grace periods using accelerated test timings.
  8. Localisation. Check price display in several regions.

Budget real time for this. Purchase bugs cost money directly and generate angry reviews. See game QA and testing cost.

Analytics

Track shop opened, product viewed, purchase started, purchase completed and purchase failed with reason. The drop between each step shows where revenue is being lost. See game analytics events to track and mobile game KPIs.

Common mistakes

  • Granting items on the client without validation.
  • Hard-coded prices.
  • Finishing the transaction before granting.
  • No handling for unfinished transactions at launch.
  • No restore button on iOS.
  • Forgetting acknowledgement on Android.
  • Testing only the happy path.

Getting help

We implement purchases with server validation for Unity and Unreal games, and fix existing integrations. Packages are on the offer page.

Sources: Apple Developer: In-App Purchase ยท Android Developers: Google Play Billing ยท Unity In-App Purchasing package. Checked November 11, 2026.

Related: Mobile game development ยท How to earn from games ยท Get a quote

FAQ

Quick answers โ“

How do in-app purchases work in a mobile game?

The game fetches products from the store, the player pays through the store's payment sheet, the game validates the transaction, grants the item and tells the store the transaction is complete.

Do I need a server for in-app purchases?

It is strongly recommended. Server-side validation confirms purchases with the store directly and prevents fake receipts and replayed transactions.

What is the difference between consumable and non-consumable purchases?

Consumables such as coins are used up and can be bought again. Non-consumables such as remove ads are bought once, owned permanently and must be restorable.

Why do Android purchases get refunded automatically?

Google Play refunds purchases that the app does not acknowledge or consume within three days, so the app must confirm every purchase after granting it.

Is a restore purchases button required?

On iOS, yes for non-consumables and subscriptions. On Android, the app should query existing purchases and restore them automatically.

Related guides

Mobile game monetization: ads vs IAP → Google Play fees in 2026 →

Adding purchases to your game? ๐Ÿ’ณ

We implement and test IAP for iOS and Android. Quote in 48 hours.