Generic In-app purchases for multiple contents

We want to allow the enduser to purchase movies from our VOD app using in-app purchases (IAP). Since our app exposes thousands of movies, we plan to create several generic consumable IAP products, one by price tier (according to the expected selling prices). Each productId can be used to buy different movies.

Once a purchase is successful (transaction in purchased state), our app needs to send the transaction id and receipt along with the movie id to our back-office in order to perform checks and eventually mark this specific movie as purchased for this user (our app being multi-platform, the purchased movies have to be available on all platforms, whatever the platform used for the purchase).

But since the purchase is solely based on the SKProduct (hence its id), and since there's no way to attach some kind of userInfo to the SKPayment added to the default SKPayementQueue, there's no direct way to match an SKPaymentTransaction to the movie whose purchase triggered its creation, especially when dealing with "Ask to Buy" and highly asynchronous transactions updates.

So, as far as I know, I have to maintain some sort of permanent context with the movie id, the product id and the last update date in order to try to get the movie id matching a transaction. But there are lots of things to take care of and a high risk maintaining this parallel context synced with the SKPaymentQueue pending transactions.

I am pretty sure other apps have the same IAP strategy so I wonder if I'm missing something obvious. Are there some recommendations from Apple on the way to handle it? Or has anyone been through this road and being able to provide advices?

Thanks for your help,
Aurélien.

Replies

Hi. I'm having the exact same issue.
The common, and only suggestion, seems to be to use "credits" like a digital currency. I don't like this idea since my app is not a game.

I went down the road of "permanent context" you are describing, and trying to "assume" that the ID of the item is the one that user last clicked buy on.

As you know, the risk here is that link is easy to lose, Apple recommends app needs to be able to process a purchase at any given time, by registering observer on launch, but I can't do it because I don't have itemId to match then.

Please let me know if you have found a solution.