Hi everybody!
This is a small guide to create and use In-App-Purchases using the iOS Store extension.
First, you must go to iTunes Connect and sign in with your Apple ID.
Note that you must have the right contracts signed to use IAP's.
Select "Manage Your Applications" and select your app that you have previously set up that you wish to add IAP's for.
Important: The "Bundle ID" of the app you are setting up IAP's for should match the Bundle ID that you are using in your MFA file.
Then click 'Manage In-App Purchases' in the menu at the right.
Under "In-App Purchase Summary" you will find a button to create a new IAP:
You must decide which type of item you are in the process of creating.
For this guide I'm sticking to simple non-consumables - which basically means that once you buy the item you will have it forever.
You should then chose a reference name for your item. This item name is only for your own reference.
It will not be shown in your app.
You must then chose a product identifier.
It is a good idea to use the inverse URL way of making an unique identifier so it doesn't clash with any other name you might be using.
For example: "com.companyname.gamename.itemname"
Under "Pricing and Availability" you must select which price tier the product should be in:
Under "In-App Purchase Details" you must name your item and describe it in the languages you decide.
Save it:
Here i added the item name and description in English and Danish:
You must decide if the content of the item is downloadable or simply just "unlockable" from your game.
If the item requires that you download some content from a server you can choose to host it on Apple's servers.
It is optional if you wish to fill out the review notes but you must supply a screenshot to Apple for
review purposes so they can see what the IAP is all about.
Save the information:
I have added three IAP items for my test app:
Press done - and you are done! (with the iTunes Connect part)
Time to set up IAP's in your MFA!
InAppPurchase.mfa
I have written a bunch of comments inside.
Please note that this is just one way of doing in app-purchases.
You can also fetch the list of items from a server using the GET Object and then fetch the item information.
You can also use the 'specific' conditions in the iOS Store object to hardcode the identifiers if you don't need to have that many IAP's in your app.
In my example file I dynamically created the buttons as the information is retrieved but you can easily
have them created beforehand with prettier graphics and then show a "progress/loading" indicator while it fetches the product information from the store.
When you are all set: export and try it in the simulator (to run it in the sandbox):
Please note that the sandbox can be quite slow at fetching the product identifiers.
It will take a while before they are shown on the screen in my example.
Also please read the help-file of the iOS Store object to read more about how In-App Purchases work.