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?
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