Receipt Validation Programming Guide

Receipt Fields

Receipts are made up of a number of fields. Some fields are only available locally, in the ASN.1 form of the receipt, or only when validating with the App Store, in the JSON form of the receipt. Keys not documented below are reserved for use by Apple and must be ignored by your app.

App Receipt Fields

Bundle Identifier

The app’s bundle identifier.

ASN.1 Field Type 2

ASN.1 Field Value UTF8STRING

JSON Field Name bundle_id

JSON Field Value string

This corresponds to the value of CFBundleIdentifier in the Info.plist file.

App Version

The app’s version number.

ASN.1 Field Type 3

ASN.1 Field Value UTF8STRING

JSON Field Name application_version

JSON Field Value string

This corresponds to the value of CFBundleVersion (in iOS) or CFBundleShortVersionString (in OS X) in the Info.plist.

Opaque Value

An opaque value used, with other data, to compute the SHA-1 hash during validation.

ASN.1 Field Type 4

ASN.1 Field Value A series of bytes

JSON Field Name (none)

JSON Field Value (none)

SHA-1 Hash

A SHA-1 hash, used to validate the receipt.

ASN.1 Field Type 5

ASN.1 Field Value 20-byte SHA-1 digest

JSON Field Name (none)

JSON Field Value (none)

In-App Purchase Receipt

The receipt for an in-app purchase.

ASN.1 Field Type 17

ASN.1 Field Value SET of in-app purchase receipt attributes

JSON Field Name in_app

JSON Field Value array of in-app purchase receipts

In the JSON file, the value of this key is an array containing all in-app purchase receipts. In the ASN.1 file, there are multiple fields that all have type 17, each of which contains a single in-app purchase receipt.

The in-app purchase receipt for a consumable product is added to the receipt when the purchase is made. It is kept in the receipt until your app finishes that transaction. After that point, it is removed from the receipt the next time the receipt is updated—for example, when the user makes another purchase or if your app explicitly refreshes the receipt.

The in-app purchase receipt for a non-consumable product, auto-renewable subscription, non-renewing subscription, or free subscription remains in the receipt indefinitely.

Original Application Version

The version of the app that was originally purchased.

ASN.1 Field Type 19

ASN.1 Field Value UTF8STRING

JSON Field Name original_application_version

JSON Field Value string

This corresponds to the value of CFBundleVersion (in iOS) or CFBundleShortVersionString (in OS X) in the Info.plist file when the purchase was originally made.

In the sandbox environment, the value of this field is always “1.0”.

Receipts prior to June 20, 2013 omit this field. It is populated on all new receipts, regardless of OS version. If you need the field but it is missing, manually refresh the receipt using the SKReceiptRefreshRequest class.

Receipt Expiration Date

The date that the app receipt expires.

ASN.1 Field Type 21

ASN.1 Field Value IA5STRING, interpreted as an RFC 3339 date

JSON Field Name expiration_date

JSON Field Value IA5STRING, interpreted as an RFC 3339 date

This key is present only for apps purchased through the Volume Purchase Program. If this key is not present, the receipt does not expire.

When validating a receipt, compare this date to the current date to determine whether the receipt is expired. Do not try to use this date to calculate any other information, such as the time remaining before expiration.