views:

356

answers:

4

Our app has a list of locked products that share the same consumable product id (i.e. one consumable product id for many products). Our server provides me with a list of products and the product id associated with them:

item name="itemA" iphoneProductId="consumable.test.1"

item name="itemB" iphoneProductId="consumable.test.1"

item name="itemC" iphoneProductId="consumable.test.1"

We chose consumable because our items are created dynamically and need to be available to the user instantly (please don't reply suggesting that we use non-consumable, there are a lot of other reasons that are too hard to explain without me giving away private details about the company we are working with, as to why we are using consumable). This allows us to have multiple products share the same price.

When the user purchases itemA (for example), the item is unlocked. However, sometimes, when the user then tries to be itemB, Apple return with 'You have already purchased this but it hasn't been downloaded. Tap OK to download it now’. This should surely never happen for a consumable item. I know our system is quite complex but as far as the apple store kit is concerned, are simply just buying the same product again.

Could this just be a sandbox issue? We can't test in live as the app isn't released yet. In fact, this whole problem is holding off the release as our client is as concerned as we are about this problem.

I've followed the same code from the iphone documentation and the few in app purchase tutorials out there. I see that a lot of people on the forums seem to have witnessed the 'already purchased' dialog above for consumable products, but none of them ever get answered.

Please help! Thanks

A: 

I'll assume you've called -[SKPaymentQueue finishTransaction:].

Off the top of my head, there are a few possibilities:

  • The store hasn't received the "finish" message yet (I don't know what ordering guarantees there are).
  • You're trying to purchase a second item before calling finishTransaction: on the first, and the App Store thinks it's a replay.
  • The App Store detects when you appear to be purchasing the same item repeatedly, and assumes that something must have gone wrong.

A hack is to cycle through a list of several (10? 100?) consumables, assuming that when you get back to one earlier in the list, it will have finished processing.

An alternative solution is to pre-allocate a lot of non-consumables ("product.1", "product.2", ..., "product.100") and assign ones with the appropriate price to products on the server. Changing prices can then be done on iTunes Connect, or by assigning additional product IDs as necessary.

tc.
+1  A: 

Thanks for your quick response, but my app does seem to be finishing the transaction, etc.

My project's in app purchase classes have become quite complex so I reverted to creating a new basic project with a test consumable product and the standard implementation of in app purchase manager/observer taken from this open source:
http://blog.mugunthkumar.com/coding/iphone-tutorial-%E2%80%93-in-app-purchases/#idc-cover

The same problem occurs. This is the order:
1. Buy the consumable product for the first time (below is the debug I printed out)
_MKStoreManager: buyFeature:test.consumable.1
__MKStoreObserver: SKPaymentTransactionStatePurchased
__MKStoreObserver: completeTransaction
_MKStoreManager: provideContent
2. "Thank you for your purchase" dialog is displayed by Apple
3. Buy the consumable product for the second time:
_MKStoreManager: buyFeature:test.consumable.1
__MKStoreObserver: SKPaymentTransactionStatePurchased
__MKStoreObserver: completeTransaction
_MKStoreManager: provideContent
__MKStoreObserver: SKPaymentTransactionStateFailed
__MKStoreObserver: failedTransaction
4. "You've already purchased this but it hasn't been downloaded. Tap OK to download it now. [Environment: Sandbox]" dialog is displayed by apple.

It just doesn't make sense in step 3 that the transaction is both purchased then failed at the same time. Do you have any ideas.

I'm getting exactly the same issue, have you been able to resolve this at all?
Roger
No I'm afraid not. After a few meetings we decided to move to non-consumable products as they were more stable. So big changes to our purchase system right at the end - not ideal! The changes worked fine though, until the past 2 days where now whatever purchase gets made, we get a 'cannot connect to itunes' alert, which breaks the whole purchase. Very disappointed with Apple's system and their documentation.
A: 

Exactly the same probleme except that in my app it didn't even pass by the "SKPaymentTransactionStatePurchased" state.

Has anyone encounter te same issue ?

antoine
A: 

Hello,

It is not worth using consumable product for non-cosumable, because Apple will reject it. Here is what happened to me:

I have had the same issue. The message explaining that you have already purchased the item appears only once in a while and mostly if you purchase a lot of things - one after the other immeadiately.

We have put it for review in the App Store anyway and got the following answer:

..... We have completed the review of your in-app purchase but cannot post it to the App Store because the Purchasability Type is not set correctly. For information on Purchasing and Currency guidelines, please see section 11 of the App Store Review Guidelines [ https://developer.apple.com/appstore/resources/approval/guidelines.html ]. ..... The purchase of a [magazine issue] is set to "consumable", however based on product functionality it should be set as non-consumable instead. ......... You are required to create a new in-app purchase product with the correct purchasability type. ..........

I hope this saves someone time and headaches.

Sasho