Receipt validation in testflight

Hi:


I have some questions about the receipt validation and testflight. First I want to ask if when a testflight build is downloaded into a device a receipt is automatically generated. If is not generated is necessary to call the function SKReceiptRefreshRequest and sign in to request a new receipt, but is required to have a sandbox account to receive a new receipt or any internal/external testflight beta tester user can ask for a sandbox receipt in the testflight build?


Thank you very much.

The testflight literature describes how you can make IAP sandbox purchases using testflight. I'm not sure the original app has a receipt until you make an IAP purchase or refresh the receipt.

iTC has told me that whenever StoreKit is used to install an application, an application receipt is part of the application. In the case of TestFlight, I'm unsure as to whether StoreKit is involved. However, it's a good idea for the application to make no assumption that the application is present. There is one production case where a production app will not have a valid application receipt - that is when the user backs up their device to a local system, then decides to restore their device from the backup and there is no network connection to the store. The app with in app purchase support will not have an application receipt in this one specific case. If the device were to be restored from an iCloud backup, the restored app would have the application receipt.


In general, treat the situation where there is no application the same as if the receipt was present, but the user had no access to the in app purchase content. The app can detect the missing receipt and alert the user that the receipt appears to be invalid and ask whether they would like to refresh the receipt. If the user agrees, then make the SKReceiptRefreshRequest call. There should be no requirement that there must be an app receipt present, for the app to continue to run.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

After testing the case that I described at the first post, I found that test flight doesn't generate a receipt when the game is installed into the device. But when the app starts and we call SKReceiptRefreshRequest in the beginning of our app, if you specify test flight user login you can get the sandbox receipt and the app can be validated.

Thank you very much for the answers.

by "StoreKit" I assume you also mean in production, the "App Store" iOS8 or better?


what is strange about this is there appears to be no way to actually test appStoreReceiptURL from local device as a developer or as a testFlight app realistically.


because when you are developing, there is no general app receipt present when you first "install" the app, so when you go to verify as Apple descibes, it fails immediately, then lets say we got past this, and we do a test IAP, well that goes fine, but then when it goes to write the reciept it fails, because there is no reciept yet? but if you restart the app from xcode, then it is finally there.... so a Developer is left wondering what actually does happen when a person does an IAP, because right now there is no way to test the actual first user experience scenario realistically? which is actually the ONLY scenario, they don't already have the IAP, that is why they are buying it.... as a developer, first you have to pretend to of just launched the app, but to have a general app reciept, the person already has to have downloaded the IAP. so no way to actually practice a "fresh" download from the App Store of a first IAP.


right now, I have to simply take a blind leap that when you said "StoreKit", you meant also "App Store" iOS8 or better.

and that when you do an IAP, it actually writes it right away on this general app receipt so that it can be tested against, it appears with my testing that generating new app reciepts that show new transaction ID's are not updating the general app receipt either even when it is finally present... so kind of blindly feeling for walls here.


is this correct?

Sorry to be slow, when I get busy with DTS incidents, I don't always have tim to review the forum posts.


As you indicate, when you install the app via Xcode, there is no appReceipt. However after a purchase of an iAP, or after a call to SKReceiptRefreshRequest, there should be an applicationReceipt. If there is not, this would be a bug report. However, in the app sandbox environment, before I filed a bug report, I'd retry things with a new test user account. I've not tested the issue where I run the app for the first time under Xcode in a while. This might be an issue and I'll try it soon.


You mentioned - "so no way to actually practice a "fresh" download from the App Store of a first IAP." This is true, but there is one case where the same issue - "no appReceipt" present, can occur in the production environment. If you backup your device to your local computer - not to iCloud, then restore your device using the local backup and there is no internat connection active, the restored iAP app will not have an app receipt.


Even after the app receipt is installed in the sandbox environment, there is a difference that you have to consider - the original_application_version field is always going to be "1.0" in the sandbox, but it will be a more relevant value in the production receipt. This can be a serious stumbing block if this case is not considered in code.


You stated - "I have to simply take a blind leap that when you said "StoreKit", you meant also "App Store" iOS8 or better."

Actually, it's iOS 7 or better.


You stated - "it appears with my testing that generating new app reciepts that show new transaction ID's are not updating the general app receipt either even when it is finally present..."

This would again be a bug report, but I'd test with a newly created test user account after having restarted the device to see if the same issue occurs.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

The system allows you to test what needs to be tested. Running from Xcode there is no receipt. That allows you to test your code for an app that is installed with no receipt. Once you successfully refresh the receipt then you can test a second time - this time using an app that has a receipt and testing for an app that was installed with a receipt. Although testing for the case of a receipt is a trivial extension of testing for the case of no receipt.


There is always a receipt after an IAP results in a call to updatedTransactions.

Receipt validation in testflight
 
 
Q