restoreCompletedTransactions() does not refresh receipt if no IAP were made

Originator:hannes.oud.dev
Number:rdar://35826524 Date Originated:04-Dec-2017 11:53 AM
Status:Closed Resolved:
Product:macOS + SDK Product Version:10.13.2 Beta (17C83a)
Classification:Other Bug Reproducible:Always
 
Summary:
SKPaymentQueue.restoreCompletedTransactions() does not refresh the App receipt if no In App Purchases were made. When developing, especially in a development signed mac Sandbox App this is inconvenient, because it would be a nice way to refresh the receipt without terminating the app.

Steps to Reproduce:
In a freshly built development signed Mac app without receipt:
Call SKPaymentQueue.restoreCompletedTransactions


Expected Results:
The receipt should be refreshed.

Actual Results:
There is still no receipt after calling this

Version:
10.13.2 Beta (17C83a)

Notes:
The alternatives are 
- exit(173) which is very intrusive in the user flow
- SKReceiptRefreshRequest. This works in Sandbox but not in production. rdar://35826398

This means there is no unintrusive reliable simple way to make an app obtain an updated receipt in sandbox and production on mac.

As soon as IAP were made the receipt is in fact refreshed. It would be more consistent if it were also refreshed without IAP.

This behaviour was observed on 10.13.1 and 10.13.2 betas

Comments

Apple Developer Relations

restoreCompletedTransactions is not meant to refresh the receipt. It is meant to replay transactions that have already gone through. If there are no transactions to replay, there will not be a receipt in the server response. If the receipt must be refreshed use SKReceiptRefreshRequest. This bug was used to fix the issue mentioned above where restoreCompletedTransactions would always fail if no account was signed in.

By hannes.oud.dev at July 11, 2018, 5:03 p.m. (reply...)

Hannes Oud

Current results: On 10.13.4 Beta (17E170c) restoreCompletedTransactions completes with Error Domain=SKErrorDomain Code=0. When starting restoreCompletedTransactions I get the App Store sign in dialog, and then it completes with that unknown error, […]

By hannes.oud.dev at March 6, 2018, 1:30 p.m. (reply...)

Apple Developer Relations

With no IAP the server does not send a new receipt. Use SKReceiptRefreshRequest to get a new receipt without replaying in-app purchases on the SKPaymentQueue. SKReceiptRefreshRequest previously only fetched a new receipt if the current receipt was invalid. The issue was fixed in macOS 10.13.2 17C60c. Try the solution with SKReceiptRefreshRequest on the latest macOS 10.13.2 GM (17C88) and please capture and attach a sysdiagnose if it doesn't work. macOS sysdiagnose Instructions: https://developer.apple.com/services-account/download?path=/OS_X/OS_X_Logs/sysdiagnose_Logging_Instructions.pdf Important: Note the date and time issue occurred and add this information to the bug report.

By hannes.oud.dev at Feb. 2, 2018, 11:28 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!