If you are developping an application for the Mac App Store, then you have to implement and test receipt validation. This entry details all the steps needed to be able to test the Map App Store receipt validation.
Note: This entry is based on various information gathered from the Apple website and especially from the Validating Mac App Store Receipts and the Technical Note 2259 documents.
As a Mac developer, you must use the Developer Certificate Utility available in the Member Center to complete the following steps:
- Register an explicit your App ID for your application.
Explicit App IDs are App IDs whose Bundle Identifier portion is a string without the wildcard ("*") character. If you are the Team Agent, you should be able to navigate to the App IDs section of the Developer Certificate Utility to register an App ID for your application.
Create, download, and install a Mac Signing Certificate that uses your App ID.
If you are the Team Agent, you should be able to navigate to the Certificates section of the Developer Certificate Utility to create a Mac signing certificate.
- Download the WWDR Intermediate Certificate.
You also have to download the WWDR Intermediate Certificate available in the Developer Certificate Utility. This certificate is needed to validate developer certificates.
To test receipt validation, you need to create test accounts to simulate the purchase. iTunes Connect allows you to create and manage Test User accounts.
- Create a test user account.
Apple provides a testing environment, called the sandbox environment, which allows you to test an application purchase without incurring any financial changes. The sandbox environment uses special test user accounts rather than your regular iTunes Connect accounts to test receipt retrieval.
Your Admin or Technical users should navigate to the Manage Users module on the iTunes Connect home page to create test user accounts. Read the Test User Setup section of the iTunes Connect Developer Guide for more information about creating test user accounts.
- Declare your application.
In order for Apple to generate testing receipt, you need to declare your application. Add a new application by providing all the required fields, and at least a screenshot. Leave the application as is; you don't need to upload anything to test receipt validation.
Note: You can use the same test user accounts to test both your iOS and Mac applications. Each test user account is tied to one and only one email address. As such, you cannot reuse an existing email address with another test user account. You can create as many test user accounts as you want in iTunes Connect. Furthermore, you can use the "+" alias provided that it is allowed by your webmail service. For instance, if your email is email@example.com, then you can use the firstname.lastname@example.org, email@example.com, and firstname.lastname@example.org emails when creating test user accounts in iTunes Connect. All communications sent to email@example.com, firstname.lastname@example.org, and email@example.com will be routed to firstname.lastname@example.org.
You have successfully set up your application, and you are ready to test the receipt validation.
- Launch or create your project in Xcode.
- Add the receipt validation code (if you look for an easy way to do so, then check out Receigen). Make sure that the bunlde identifier and the bundle version match between your application and the generated code.
- Build your application in Xcode.
Note: You must launch your application from the Finder rather than from Xcode the first time in order to obtain a receipt. When your application is launched, Mac OS X displays a "Sign in to download from the App Store." dialog. Enter your test user account and password as requested. The sandbox provides you with a new receipt upon successful authentication.
Note: Launch your application from the Finder whenever you need a new receipt.
Important: You must not use your test user account to sign into the production environment. This will result in your test user account becoming invalid. Invalid test accounts cannot be used to test receipt validation.
- Submit your products for review.
Log in to iTunes Connect to submit your application for review by Apple, after you are done thoroughly testing them in the sandbox environment.