In-App Purchase in iOS Applications

In-App Purchase in iOS Applications

Categories IOS | Mobile Applications

In-App purchase is one popular way of increasing business revenue from your iOS application. In today’s saturated mobile app markets, in-app purchases have redefined the app making business. From monetization standpoint, adding products in your iOS app will raise the bar to next level. In-app purchase technology allows you to sell additional app-products or digital products within your paid or free application. It facilitates the sale of products or services within your iOS application, through a smartphone device.

It is similar to making your game app more interesting by unlocking further levels and providing extra powerful sword or magic money box to the players.

Wide variety of content can be put up for sale on your iOS app, such as additional features or premium services, images, game levels or a magic wallet through which players can have unlimited money to play further levels. In app purchase have different types and can be integrated with your app as per the requirements

For in-app purchases the prerequisites are:

 

  • ITunes Connect
  • iOS Provisioning Portal
  • Custom Code
  • StoreKit

How to implement In-App purchase in iOS?

In app purchase service is accessed by your application through StoreKit API installed on your device. Prerequisites to implement in-app purchase in your iOS application are:

  • Create a unique app ID in iTunes connect. While creating a new app, make sure you update with Bundle ID and code signing with XCode.
  • Create a new app and add app information
  • Add a new product for in-app purchase through “Manage in-app purchase”
  • For in-app purchase to work, make sure to set-up bank details for your application.
  • Create test user account in iTunes connect page using ‘Manage user’ accounts
  • Create UI for in-app purchase
  • After this create a single view app and enter bundle identifier.
  • Update ViewController.xib and create IBOutlets. Add store StoreKit framework.

A connection between the iOS application and Apple iTunes server is established by StoreKit to get product information and perform transactions. To implement in-app purchase in your iOS application, you need to follow the steps below:

1) Have you created an app id?

First step is to create app id. For this go to developer-> member centre-> appID

 

 create app id

 

 

Create provision profile. In order to do this, click on ‘Provisional Profile’ tab on left hand side-> select development->click on + icon-> select iOS development then select on the APP ID created in step 1. Then select certificate and device on which you want to run the iOS application. Next step is naming the profile and downloading it.

 

 create app id

2) Have you enabled In-App Purchases for your App ID?

After you have logged into the provisioning portal select App ID and click ‘new app id’. Enter a common name and a unique bundle identifier. With this common name you will identify the app id in provisioning portal and bundle identifier will be the unique identification for your app. On the main app id page you will find your “APP ID” with a configure link on the right. Then select the checkbox next to “Enable in-app purchase”.

 

 

 enabled In-App Purchases for your App ID

 

3) Have you checked Cleared for Sale for your product?

The in-app purchase form has a ‘Cleared for Sale’ Checkbox. Checking that box will determine that the products in your application are available for sale. If this box is unchecked, the in-app purchase will not be available for purchase

4) Does your project’s .plist Bundle ID match your App ID?
  • While creating a new app id, make sure the project’s .plist Bundle ID match your app id. Pick a different App ID name than before.
  • Generate a new prefix and the format of suffix must be like this “ com.companyname.appname”
5) Have you generated and installed a new provisioning profile for the new App ID?

After generating the provisional profile that points to the app id you can drag the profile onto the Xcode icon in the Dock to install. You can also install the profile manually by selecting Window> organizer in Xcode, clicking ‘Provisioning Profiles’ category on the left. Then ctrl-click an existing profile, > reveal in finder and lastly drag and drop new profile into profile finder window.

6) Have you configured your project to code sign using this new provisioning profile?

To use provisioning profile in the Xcode, you must edit the project’s .plist file to match Bundle id with App id. Also, edit the project’s target info by following the points below, for using provisioning profile:

  • Select Project > Edit Active Target
  • Select the “Build” tab
  • Check the configuration you desire
  • Select your new provisioning profile for Code Signing Identity and the row underneath
7) Are you using the full product ID when when making an SKProductRequest?

In the SKProductsResponse object, check invalid product identifiers. Make sure it is empty and configure your identifiers properly on iTunes connect.

8) Have you waited several hours since adding your product to iTunes Connect?

Wait for 24 hours for the product to propagate through Apple’s distributed network. If it is still not working, you might have to check working of your device once.

 

9) Is your device jail broken? If so, you need to revert the jailbreak for IAP to work.

To revert back a jailbreak on your phone, follow the steps below:

  • Access iTunes on your desktop and connect iPhone 5 with it through USB.
  • Restore to an existing firmware or Update to latest available firmware and select the device on the list in iTunes
  • Restore or Update at the same time by clicking the shift key.
  • Choose the relevant ipsw firmware file that you are updating to.
  • The device will restore to factory settings.
  • The device will no longer be jailbroken
10) Testing

Before testing in-app purchases, sign out of iTunes Store on your device by opening the settings app, tapping the ‘Store row’ and tap ‘Sign Out’. After this you can test successfully from your device

11) For iOS7 and Xcode 5

For these you have to test on device as apple restrict IAP testing in simulator.

Go to setting -> iTunes & App Store -> and log out of your account. Remove app from device and clean all data.

Such purchases have become a rising trend in mobile app markets to make additional money by selling extra products and services through your app. At TBI we never underrate the influence of in-app purchase, which is why our services are of superlative quality. If you too are looking to monetize your app through in-app purchases, you can always Reach Out To Us.