You have an in-app purchase bug in your application, Fix it!

A bug in your payment is a very bad thing because it may hurt your revenue

Amr Salman

--

Part of being an iOS developer is to deal with what rules Apple forces on us to implement, a big one rule is in-app purchases using StoreKit.

In the documentation, it seems a bit overwhelming at first but after a couple of minutes, you will think “Oh! I got it, this is straightforward, I guess!” but believe me it isn’t.

I get it BTW in-app purchase is better for consumers end but the big problem is that your system needs to include additional layer with different designed functionality. What I mean is there are very important functions like Restore purchase for example but the real problem comes in integration.

Most systems will initiate the purchasing operation and once the delegate report back that it’s completed successfully, then the app report to a remote server that this user has purchased this item or subscribed to this plan and maybe send the receipt to be validated by the server. after that server add a record for that user’s purchase after validating it.

Straight forward right? Wrong! what if the user logged out from his account in your app and created a new account or logged in to another account and request to restore his purchase your app will reach out to StoreKit and ask to restore his purchase and surprise! .. user got a subscription/item that never purchased for this account.

The problem is in integration as I said before. Purchase is recorded in his Apple ID that will always report back True to restore purchase and your system has its own user-id that will record the purchase and even if you validate the purchase you’ll find it valid because he didn’t do anything wrong according to the rules.

So is this issue really exist? .. the answer is YES it is widespread in almost every app that uses in-app purchases, especially for subscription-based applications.

Is there a solution? .. of course, you need to identify your user’s purchase and either move it to the latest account the requests restore purchase (which is a better experience in my opinion) or you can reject the request to restore from another account.

--

--