How do I restore purchases in an iMessage App Extension?

This code works in my main app, but in the iMessage App Extension, it throws an error.


Error Domain=SSErrorDomain Code=4 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}


func restoreInAppPurchase() {
    receiptRequestHolder = SKReceiptRefreshRequest.init(receiptProperties: [:])
    receiptRequestHolder!.start()
}


Is restoring purchases in this manner simply not possible in an iMessage App Extension?

Replies

Same thing happens when you try to restore via restoreCompletedTransactions. I've been reporting this bug since iOS 11 but it still isn't fixed 😟, please report it to Apple as well via Bug Reporter so that there is more than one person reporting this bug and Apple might finally fix it. Thanks.

Ditto, zippo. Please make a bug report. The more that report, the better.

Ok I reported the bug. It really is an awful issue. I guess no one will be able to see my report directly, but here is the link. https://bugreport.apple.com/web/?problemID=46568601

Hello,


I think i got the same issue with my iMessage app extension.

When i use the method :

SKPaymentQueue.default().restoreCompletedTransactions()

to restore transactions i got an error message telling me there is no information about in-app purchases - Sandbox environnement - 21105.


This is probably linked with the receipt created by :

let _receiptRequest = SKReceiptRefreshRequest()
_receiptRequest.start()

The SKReceiptRefreshRequest() never works, i can't have a receipt from apple with it.


So, when i want to test the in-app purchases in sandbox environnement, i need to purchase one of the in-app purchases of the iMessage Extension. Purchase an in-app is the only way that worked to get a receipt. And if i delete the app and download it again i need to purchase each time one in-app to restore the purchases.


I tested this basic method in sandbox environnement in my developpment device and in testflight environnement. Each time same result, to create a receipt it need a bought.


I wonder if its a problem linked to test environnement. If not, the customer will not wan't to buy something they already got to restore purchases.

Its not just the test environment. A bunch of devs have seen this issue since iOS11. Prior to 11, restoring was working fine in Messages extensions. In my case though, the customer can inititate a second purchase and the app will tell them they've bought before, and it gets restored that way. But obviously no one wants to tell customers "oh trust me, buy it again, and it won't really charge you".

Thanks for your ansewr CartoonSmart.com,

Yes what you described is exactly what happened, and if it happens the same in production environnement there is really a issue for the user experience.

If someone have a solution about how to restore purchase in a iMessage extension app it would be helpfull.

Is there any update on this issue? I am having the exact same problem with iMessage app extension and so far it feels wrong to give away IAP code for 30$ and then ask - buy it again after you redeemed code and you will get all unlocked.