How Receigen’s validation works

The generated code follows a simple logic:

  1. the receipt validation steps are performed
  2. if the validation succeeds, then execute a success behavior
  3. if the validation fails, then execute a failure behavior

Depending on the use-cases and your need, the success/failure behaviors may vary. Receigen can generate a wide variety of behavior whether the validation succeeds or fails:

Prerequisites

On OS X, the prerequisites are:

A valid developer certificate generated on the Mac Dev Center. DO NOT USE a Developer ID certificate.
A valid application ID declared on the Mac Dev Center.
A valid application declared on the iTunes Connect portal.
A sandbox test user declared on the iTunes Connect portal.
An OpenSSL binary distribution with static libraries.

On iOS, the prerequisites are:

A valid developer certificate and a valid provisioning profile generated on the iOS Dev Center.
A valid application ID declared on the iOS Dev Center.
A valid application declared on the iTunes Connect portal.
A sandbox test user declared on the iTunes Connect portal.
An OpenSSL binary distribution with static libraries.

Project Preparation

The receipt validation code depends on OpenSSL 1.0+. Thus, the code needs to be statically or dynamically linked with that library.

Please refer to the OpenSSL guide to prepare your project environment.

Generate Validation Code

The validation code can be generated by either the Code Assistant or on the Command Line. The following matrix lists the most common validation use-cases (actually there are a lot more options available):

Platform Use-Case Generation Options
OS X Startup receipt validation at startup Use RunApplication for the success behavior and ExitWith173 for the failure behavior.
OS X Receipt validation during application’s lifecycle Use DoNothing for the success behavior and ExitWith173 for the failure behavior.
OS X Retrieving receipt properties Use CallBlock for the success behavior and CallBlock for the failure behavior.
OS X Check InApp purchases Use CheckInApp for the success behavior and ExitWith173 for the failure behavior.
iOS Basic receipt validation Use DoNothing for the success behavior and RefreshReceipt for the failure behavior.
iOS Retrieving receipt properties Use CallBlock for the success behavior and CallBlock for the failure behavior.
iOS Check InApp purchases Use CheckInApp for the success behavior and RefreshReceipt for the failure behavior.

Integrate the code

You can find full examples of integration in the integration guide. You can also refer to the Customization guide to learn more about the possibilities.