Please check my workflow for IAP using MBS StoreKit

Just purchased the MBS complete plugins for using StoreKit. I was following along with the example project (which doesn’t seem too bad), and there are a couple of “todo’s”. Would someone like to check my workflow and comment if this seems right or can be improved?

  • Click the Purchase button. This fires the AppStoreModule to purchase
  • User confirms the purchase, and this moves to the state of Purchased
  • Calls the completeTransaction method, which first has a recordTransaction and then provideContent (these two are my biggest questions)
    – recordTransaction: I’m assuming this is where you would save the info on the purchase. I have been reading and see that using the NSUserDefaults is the way to go (in lieu of saving some data to a table). I do also have iOSKit installed so can make use of the NSUserDefaults. So is something like this correct to save to NSUserDefaults?

Foundation.NSUserDefaults.StandardUserDefaults.SetBoolForKey(True, identifier)

I believe “identifier” will by my IAP identifier as this property is already being filled in the early stages of the MBS StoreKit

  • provideContent: Correct me if I am wrong, but here, I would make my activatePremium global property set to True, so the next time the user clicks into a premium feature, they will be taken there and not to the modal purchase window. Is this all that needs to occur here?
  • Then the next time the user opens the app, I would make a call to NSUserDefaults to check if this is True, and then set activatePremium property to True. Something like this?

activatePremium = Foundation.NSUserDefaults.StandardUserDefaults.BoolForKey(productID)

The productID would be set to a constant of my IAP identifier: com.visualveggiessoftware.dietitianexamtogo.premium. If it matched, the property is set to True. If there is no match, it is set to False and would bring up the purchase modal. Am I on the right track?

Separate question on refunded purchases. I read a few posts saying it’s not worth the hassle of validating the receipt as refunded apps is quite low. True? Guessing if I don’t bother building in a check for this, then a user can purchase the premium, request a refund, and continue to use the premium for free

Your workflow is correct.

Yes this is correct. Refunded transactions represent 0.5-2% of all transactions, I personally do not verify the receipt for refunded apps.

1 Like

Thanks for checking and for answering the refund question!

1 Like

It’s up to your app on how you store the premium flag.
Beside restoring transactions, you may want to use e.g. a SQLite database for preferences (see example coming with MBS Plugin). or just some kind of JSON/XML file in your documents or preferences folder for the app.

Good tip, thanks! Will have to look to do this in the next update. My app (with IAP) just got approved!

@Christian_Schmitz i have to say, your MBS StoreKit worked great and was easy to implement and easy to follow along through the example. Great work. Satisfied customer here! :smiley:

1 Like

Hi @Ryan_Hartz
I am switching over to MBS StoreKit also and it is basically working except for when the purchase is made the App disappears into the background. I still get the prompts that the purchase has been processed and you are set to go but then I have to retrieve the App from the background and it is back on the mainmenu screen not the screen that activated the IAP.

Any thoughts?

Thanks
Martin

Disappears in the background?
Is it maybe crashing?

Can you check for a crash log file or maybe log if you get some kind of exception?

I was saving the purchase from the wrong method, once I changed to saving as suggested by Ryan above via IOSKit it all started behaving.
Thanks

1 Like

Yes, I would say using MBS StoreKit was a great switch for me. It’s very easy to implement, and once you get it all configured in your first app, it’s easy to adhere to any other IAP apps you’ll bring to market

3 Likes