StoreKit: Unable to re-download purchased content on re-purchase of non-consumable

Originator:heiko.wichmann
Number:rdar://9695698 Date Originated:29-Jun-2011 01:16 PM
Status:Open Resolved:
Product:iOS Product Version:4.3.3
Classification: Reproducible:Always
 
29-Jun-2011 01:16 PM Heiko Wichmann:
Summary: On re-purchase of a non-consumable item, the app receives a failure message that cannot be distinguished from the user cancel event

Steps to Reproduce: 
1. Setup your app for In-App purchase with non-consumable items
2. Purchase an item
3. Apple dialog appears: "Purchase was successful"
3. Purchase the same item again
4. Apple dialog appears: "Item was purchased already. Tap OK to re-download".

Expected Results: App re-downloads the purchased digital good

Actual Results: App does not re-download because it cannot distinguish the received failure message from a user cancel event

Regression: -


Notes: 

These are the calls received in the app (in StoreKit callback (void)paymentQueue:updatedTransactions:):

SKPaymentTransactionStatePurchasing
SKPaymentTransactionStateFailed

The received error code 2 is the same as when the user cancels the purchase. The SKPaymentTransaction does not have a receipt either.
So there is no way for the app to know that a re-download is requested here although Apple's StoreKit dialog tells the user differently.


30-Jun-2011 02:45 AM Heiko Wichmann:
Problem still exists. Provided sample app.

30-Jun-2011 02:46 AM Heiko Wichmann:
Problem still exists. Provided sample app for demonstration purposes.

30-Jun-2011 02:52 AM Heiko Wichmann:
Tested with iOS 5b2. Same behavior as with iOS4.

04-Jul-2011 11:19 AM Heiko Wichmann:
Is this a iap sandbox only defect??
Today I experienced these two different sequences on re-purchase of an in-app-purchase item:

1. (as described in this bug)
i. SKPaymentTransactionStatePurchasing
ii. SKPaymentTransactionStateFailed

2. (expected behavior)
i. SKPaymentTransactionStatePurchasing
ii. SKPaymentTransactionStatePurchased
iii. removedTransactions


04-Jul-2011 11:23 AM Heiko Wichmann:
What is the sequence of updatedTransactions callbacks we can expect to receive on re-purchase?

04-Jul-2011 03:08 PM Heiko Wichmann:
Steps to Reproduce [Updated]:

1. Setup your app for In-App purchase with non-consumable items
2. Launch app
3. Purchase an item
4. Apple dialog appears: "Purchase was successful"
5. Quit app
6. Make sure to not be logged in at Settings > Store
7. Launch app
8. Purchase the same item again
9. Apple dialog appears: "Item was purchased already. Tap OK to re-download".
10. -> SKPaymentTransactionStateFailed

This bug is in sandbox and production environment of iap. It seems to be caused by internal session management. With a stable session established already (logged in via Settings > Store), on re-purchase the app receives SKPaymentTransactionStatePurchased after SKPaymentTransactionStatePurchasing (as expected).

Comments

27-Jul-2011 03:57 PM Heiko Wichmann:

Ok - in a clean environment I was not able to reproduce this defect.

This issue has been verified as resolved and can be closed.

By heiko.wichmann at July 27, 2011, 4:04 p.m. (reply...)

21-Jul-2011 07:14 AM Patrick Collins :

Engineering has provided the following feedback regarding this issue:

This sounds like the app is re-purchasing an unfinished transaction. That causes the new transaction to be canceled and the original transaction should be loaded into you queue if it's not there already. Are you sure the app is finishing its transactions when this occurs?

By heiko.wichmann at July 27, 2011, 4:03 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!