Receipt

@objc(DTReceipt)
@objcMembers
public final class Receipt : NSObject

An iTunes store sales receipt.

  • The app’s bundle identifier. This corresponds to the value of CFBundleIdentifier in the Info.plist file.

    Declaration

    Swift

    fileprivate(set) public var bundleIdentifier: String? { get }
  • The app’s bundle identifier original data. This is required for validation.

    Declaration

    Swift

    fileprivate(set) public var bundleIdentifierData: Data? { get }
  • The app’s version number. This corresponds to the value of CFBundleVersion (in iOS) or CFBundleShortVersionString (in OS X) in the Info.plist.

    Declaration

    Swift

    fileprivate(set) public var appVersion: String? { get }
  • An opaque value used, with other data, to compute the SHA-1 hash during validation.

    Declaration

    Swift

    fileprivate(set) public var opaqueValue: Data? { get }
  • A SHA-1 hash, used to validate the receipt.

    Declaration

    Swift

    fileprivate(set) public var SHA1Hash: Data? { get }
  • The version of the app that was originally purchased. 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

    Declaration

    Swift

    fileprivate(set) public var originalAppVersion: String? { get }
  • The date when the app receipt was created. When validating a receipt, use this date to validate the receipt’s signature.

    Declaration

    Swift

    fileprivate(set) public var receiptCreationDate: Date? { get }
  • The date that the app receipt expires. 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.

    Declaration

    Swift

    fileprivate(set) public var receiptExpirationDate: Date? { get }
  • The app’s age rating. Note: not documented

    Declaration

    Swift

    fileprivate(set) public var ageRating: String? { get }
  • The type of the receipt. For example ‘ProductionSandbox’. Note: not documented

    Declaration

    Swift

    fileprivate(set) public var receiptType: String? { get }
  • Date with type code 18, unknown purpose

    Declaration

    Swift

    fileprivate(set) public var unknownPurposeDate: Date? { get }
  • Array of InAppPurchaseReceipt objects describing IAPs.

    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.

    Declaration

    Swift

    fileprivate(set) public var inAppPurchaseReceipts: [InAppPurchaseReceipt]? { get }
  • The designated initializer

    Declaration

    Swift

    public init?(data: Data)
  • Convenience initializer. Decodes the PKCS7Container at the given file URL and decodes its payload as Receipt.

    Declaration

    Swift

    public convenience init?(contentsOfURL URL: Foundation.URL)