Reputation: 1259
In the first version, I was using 3 product id's
And in my new version of app there are 2 product id's, which are totally new
So my question is, for old users who have already purchased a subscription with old product id's, how he will be able to restore with the new version.
Currently, I m using below code to restore the purchase, but it doesn't restore old product id's.
SwiftyStoreKit.restorePurchases(atomically: true) { results in
APP_UTILS.hideHUD()
for purchase in results.restoredPurchases {
if purchase.needsFinishTransaction {
// Deliver content from server, then:
SwiftyStoreKit.finishTransaction(purchase.transaction)
}
}
//self.showAlert(self.alertForRestorePurchases(results))
}
Upvotes: 2
Views: 1491
Reputation: 639
Use this code to restore In App Purchases based on the product ID with SwiftyStoreKit
:
SwiftyStoreKit.restorePurchases(atomically: true) { results in
for product in results.restoredPurchases {
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
if product.productId == "PASTEPRODUCTID1HERE" {
print("PRODUCT 1 is restored")
} else if product.productId == "PASTEPRODUCTID2HERE" {
print("PRODUCT 2 is restored")
}
}
}
Upvotes: 1