tikhop / TPInAppReceipt

Reading and Validating In App Purchase Receipt Locally.
MIT License
635 stars 95 forks source link

Family sharing purchase not included in refreshed receipt #91

Closed tealshift closed 3 years ago

tealshift commented 3 years ago

Hi, I have one report of a user whose spouse had purchased the same IAP they are trying to register on their phone. The purchase function returns the alert:

Screen Shot 2021-07-16 at 11 02 30 AM

However the refreshed receipt does not include the product they own via family sharing. Here is some discussion about this issue I found: https://developer.apple.com/forums/thread/684017

tikhop commented 3 years ago

Hi @tealshift, I'm sorry, I totally missed your issue.

I don't know what can I do here, the library is just parsing the local receipt and it doesn't care whether the receipt is up-to-date or not.

tealshift commented 3 years ago

No problem. The answer provided in my link seems to do the trick.

Calling SKPaymentQueue.restoreCompletedTransactions appears to generate a new receipt on the device that does now include purchases from other family members. You don't need to actually process any of the restored transactions, because it is just a receipt we are after, you just need to call it to get that new receipt containing items purchased by other family members.

tealshift commented 3 years ago

Perhaps it would be worth including this info as a tip in the ReadMe?

tikhop commented 3 years ago

Agree, I will include it. Thank you!