TomSawyer
TomSawyer

Reputation: 3820

iOS: Can't restore consumable purchases in the sandbox environment

I've created some consumable IAPs and test it in the sandbox environment. However, restoring purchases doesn't return any transaction even i've purchased few items...

How do i test it? Here is my code

button's trigger to activate restore purchases

if (SKPaymentQueue.canMakePayments()) {
                print("restore payment")
                SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
            }

Restore purchases paymentQueueRestoreCompletedTransactionsFinished

func paymentQueueRestoreCompletedTransactionsFinished(queue: SKPaymentQueue) {
        print("\(queue.transactions.count)")
        for transaction:AnyObject in queue.transactions
        {
            let trans : SKPaymentTransaction = transaction as! SKPaymentTransaction
            //var identifier : NSString = trans.payment.productIdentifier
            let identifier : NSString = trans.originalTransaction!.payment.productIdentifier

            print("pdi \(identifier)")
        }
    }

Upvotes: 0

Views: 476

Answers (1)

if-else-switch
if-else-switch

Reputation: 977

Consumable products can't be restored from apple server. For consumable products you will have to manage the purchase list manually at your own server. If you want restorable products then you can simply do it with Non-Consumable products in iTunes.

Upvotes: 1

Related Questions