Many people struggle to have their IAP configured correctly. The PhoneGap In-App-Purchase plugin provides an easy way to ensure everything is configured as it should on the iTunesConnect side. Just follow the 4 steps bellow.
Step 1 – Install PhoneGap
The first and only requirement is to have PhoneGap installed.
$ npm install -g phonegap
Step 2 – Download the PhoneGap-InApp-Purchase plugin
Download the plugin directly from github for the most up-to-date code.
$ git clone git://github.com/j3k0/PhoneGap-InAppPurchase-iOS.git
Or get one of the stable releases.
Step 3 – Prepare the test project
From the PhoneGap-InApp-Purchase folder:
$ ./test/run.sh xxx yyy
- xxx being the bundle ID of your app.
- yyy being the in-app-purchase product ID to test.
Step 4 – Run on a device
Open the project in XCode:
$ open ./test/v31-build/platforms/ios/TestIAPv31.xcodeproj
Before launching, make sure to log out from iTunes on the device (from Settings -> iTunes).
Launch the project on an actual device, after a few seconds, you should normally see the details of your In-App-Purchase appear on screen. If not, you have a problem with the configuration of your IAP, to be solved in iTunes Connect.
Click on the price to make a purchase, make sure you are logging in with a Test User! (To add a Test User, visit iTunes Connect and click “Manage Users”). Confirmation of the purchase should appear in the XCode console.
If this doesn’t work, your IAP is either not configured correctly or not yet available from Apple’s servers (which could take up to 24 hours). Check out that you did everything, a good starting point being Apple’s own documentation.
I hope this helped!