Reputation: 14527
With in app purchase, when the user reinstalls an app on a device and selects the option to purchase the app again (instead of restore) after they've already bought it, it will come back as SKPaymentTransactionStatePurchased
and not SKPaymentTransactionStateRestored
in - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
.
I am wondering, is there a way to differentiate between a "SKPaymentTransactionStatePurchased
" that is being purchased for the first time and one that is just a free reinstall of a purchase that the user has already made?
Upvotes: 1
Views: 69
Reputation: 14527
Actually, there is a way to determine this. If:
transaction.originalTransaction != nil && transaction.transactionState == SKPaymentTransactionStatePurchased
then this would indicate that the product has already been purchased.
Upvotes: 0
Reputation: 4277
I do not think that is possible.
You can actually do something better:
When the user purchases some IAP product for the first time, you can store that information in the iDevice Keychain. In this case, even if the user deletes the app and reinstalls it, you can programmatically check if the corresponding value was already set in the Keychain, give the user all the additional functionality, without bothering him to restore or purchase again.
Only if the iOS is reinstalled that info about purchases may be lost.
Upvotes: 1