Handling Non-Consumable IAP items using SDKBOX


Handling your IAP items is quite an easy task, if you are using SDKBOX plugins.
You need to be cautious with the following quick-checks to handle your IAP items.

This post primarily aims at informing developers the correct way to implement and test Non-Consumable IAP items using SDKBOX IAP plugin.


Setting up IAP using SDKBOX

At this point of time we assume that you have installed the IAP plugin from SDKBOX and are ready with the sample code injected into your sdkbox_config.json. If not, please go through the link – http://docs.sdkbox.com/en/plugins/iap/

Your sdkbox_config.json will look like this –

As you can see there’s a “type” parameter specifying non-consumable in it.
But wait ! That’s not all to make it to work.


Difference in Non-Consumable IAP’s for iOS and Android

While adding your IAP items in itunesconnect you will be prompted to select an item type –  i.e. consumable or non-consumable. But, it’s a little different when it comes to your Google Play Developer Console. In the later, you will add all IAP items as managed products.


Managing Non-Consumable IAP items

In order to get correct non-consumable IAP’s for you make sure that you follow these steps –

Update sdkbox_config.json

  • Specify the “type” parameter for your non-consumable IAP items like the above mentioned in sdkbox_config.json as in “YOUR_IAP_NAME”.

Save purchase status to an UserDefault

  • Use either local device storage like UserDefault or any remote server to store your non-consumable IAP item purchase status.For example –

    The default value for this UserDefault would be false. So, once you install the your code should handle the IAP item based on this value.

    For instance – we will disable the button of your non-consumable IAP, now if the user clicks on it it would take them to the IAP call, something like this –

    NOTE: You need to handle how to disable the item,  MenuItem or Buttons disable (say)

Handling onSuccess() and onRestored() callback

  • Handle your onSuccess() callback something like this –

  • Say, you had purchased “YOUR_IAP_ITEM” before which was a non-consumable IAP, you could get your item again by simply invoking restore() , provided you installed the app again from playstore/appstore using the same user ID. IAP non-consumable items can be restored using sdkbox::IAP::restore() which would invoke the onRestored() callback. Here’s how to handle it –


This brings us to the end of the post about handling non-consumable IAP items.

Posted in Uncategorized Tagged with: , ,