I have a macOS app with auto-renewable subscription. I'm reading the docs and cannot fully understand the concept. According to the docs I have to add and observer to the payment queue. I have to provide a restore function to restore a purchase if the app was reinstalled. My observer is listening to the queue and it gets restored transactions once I call SKPaymentQueue.default().restoreCompletedTransactions() method. However, I cannot see if the subscription expired or not just using the observer. Transaction objects which I reecive in the payment queue have only some abstract transaction ID.The docs recommend to validate a receipt. I'm sending base64 encoded receipt to my server which in turns sends it to verifyReceipt endpoint. Even if I send an old receipt, Apple responds with JSON containing latest_receipt_info where I can see the current status of subscription and it's expiration date. I can assume that subscription is not active if expiration date is earlier than the current date.The question is why I have to call SKPaymentQueue.default().restoreCompletedTransactions() method to restore a purchase if I can refresh the receipt (if it's missing) and send it to my server and get the recent info? It seems to me that it is redundant. So my usage is:Listen to the payment queuePerform receipt validation as soon as I get transaction with purchased state and unlock paid functionality if I see a transaction with specific productId and expiration date later than the current datePerform receipt validation when user clicks Restore button and unlock paid functionality if I see a transaction with specific productId and expiration date later than the current datePerform receipt validation on every launch of the application to check the subscription statusPerform receipt validation every 12 or 24 hours to disable paid functionality if the app was not closed but the subscription already expiredDid I clearly understood the concept or am I missing something here because I don't see the benefit of calling SKPaymentQueue.default().restoreCompletedTransactions() method?
Post
Replies
Boosts
Views
Activity
I have a sandbox test user which I used to test In-App purchases. Everything was working until I upgraded to macOS Catalina (10.15.3).If I try to refresh a receipt when it's not available with SKReceiptRefreshRequest() it fails with error: Error Domain=SKErrorDomain Code=0 "(null)".Calling exit(173) shows error message: {application name} is damaged and can't be opened. Delete {application name} and download it again from the App Store.In any case I can see a warning in Console.app: Subsystem: com.apple.commerce Category: CommerceKit message: <ReceiptRefreshRequest: 0x7fb7cb439c90>: Error fetching receipt for {application name} - Error Domain=com.apple.commerce.server Code=500317 "(null)".There was no problem on Mojave so it was broken in Catalina. Did anyone found a solution?