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.0+. Thus, the code needs to be statically or dynamically linked.

Generate Validation Code and Integrate it

The validation code can be generated by either the Code Assistant or the command line.

The following matrix lists some common validation use-cases:

Platform Use-Case Generation Options Where to put the code
OS X Startup receipt validation at startup Use RunApplication for the success behavior and ExitWith173 for the failure behavior. Replace the NSApplicationMain with CheckReceiptAndRun.
OS X Receipt validation during application's lifecycle Use DoNothing for the success behavior and ExitWith173 for the failure behavior. Call the <PREFIX>_CheckReceipt function.
OS X Retrieving receipt properties Use CallBlock for the success behavior and CallBlock for the failure behavior. Call the <PREFIX>_CheckReceipt function and pass a <PREFIX>_CallBackBlock.
OS X Check InApp purchases Use CheckInApp for the success behavior and ExitWith173 for the failure behavior. Call the <PREFIX>_CheckInAppPurchases function and pass an array of product identifiers and a <PREFIX>_InAppValidateBlock.
iOS Basic receipt validation Use DoNothing for the success behavior and RefreshReceipt for the failure behavior. Call the <PREFIX>_CheckReceipt and pass an instance of SKRequestDelegate.
iOS Retrieving receipt properties Use CallBlock for the success behavior and CallBlock for the failure behavior. Call the <PREFIX>_CheckReceipt function and pass a <PREFIX>_CallBackBlock.
iOS Check InApp purchases Use CheckInApp for the success behavior and RefreshReceipt for the failure behavior. Call the <PREFIX>_CheckInAppPurchases function and pass an array of product identifiers, a <PREFIX>_InAppValidateBlock and an instance of SKRequestDelegate.

You can find full examples of integration in the integration guide.