In-app purchase on Android and iOS

Jim Mckeeth recently recorded a developer skill sprint showing how to use In App purchase on Android and iOS.

Using the Capitals Quiz demo that ships with RAD Studio and Appmethod, he covered common scenarios of how to use in-app purchases to disable adverts, to purchase additional items, restore purchases that had been made on another device and also consume a purchased item, all using common code that works across Android and iOS.

There are loads of great notes on in App Purchase on docwiki

A summary of key steps

On Android

You need / see

  • An application license key ID (which is very long and may need splitting over two lines) – You need to upload your app to the Google Play store first (recommended as alpha) to get this key and then you can re-upload later on.
  • Unique product ID’s – which point to Managed products online
  • To create a key store and set this to be used in the Project Options.
  • (and also a number of other steps.. e.g setting up merchant account)

On iOS (iTunes)

You need / see

  • From the developer portal, you need the AppID (non wild card version) and need to ensure the App has InApp purchases enabled.
  • Use iTunes connect to create the purchase item, including setting price Tier
  • Add language and display name for the purchase, and also add in screen shots to show what happens.

Once setup you can call

  • InAppPurchase.PurchaseProduct() and pass in the ID for the product to purchase a product.
  • Define an InAppPurchase.OnPurchaseComplete event to define what happens once an item is purchased.
  • Query InAppPurchase.IsProductPurchased etc..

Other Resources

He does also mention that setting applications live can take a few hours.

Watch the replay here:

Leave a Reply

Your email address will not be published.