SKPaymentTransaction originalTransaction.transactionReceipt nil for non-consumable recovery
After calling restoreCompletedTransactions, for non-consumable, the returned SKPaymentTransactions seem to have a null value in the originalTransaction.transactionReceipt property. This is where the documentation says we should find the original transactionReceipt:
Has anyone really got this to be non-zero - and if so, how?
In the returned SKPaymentTransactions, it appears as if the actual valid transactional connection belongs to the transactionReceipt property (and not the originalTransaction.transactionReceipt property).
source to share
It happened to me.
It's strange, but even if Apple states in its documentation what transactionReceipt
is in originalTransaction
, I found transactionReceipt
in the original class SKPaymentTransaction
.
So, I set up a little check before choosing which transaction to go next:
SKPaymentTransaction *passedTransaction = nil;
if (transaction.transactionReceipt) {
passedTransaction = transaction;
} else if (transaction.originalTransaction.transactionReceipt) {
passedTransaction = transaction.originalTransaction;
}
source to share
I also faced the same problem. It would seem transactionReceipt
to originalTransaction
will always return zero when restoring purchases. From the discussion in apple docs for transactionReceipt
:
Discussion The
content of this property is undefined unless it is transactionState
set to SKPaymentTransactionStateRestored
.
Since it is transactionState
always set to during restore (consumable item) SKPaymentTransactionStatePurchased
, the property originalTransaction.transactionReceipt
will always be nil.
source to share