Receipt

itunesiap.receipt

A successful response returns a JSON object including receipts. To manipulate them in convinient way, itunes-iap wrapped it with ObjectMapper.

class itunesiap.receipt.ObjectMapper(data)

A pretty interface for decoded receipt object.

__DOCUMENTED_FIELDS__ and __UNDOCUMENTED_FIELDS__ are managed lists of field names. They are regarded as safe values and guaranteed to be converted in python representation when needed. When a field exists in __OPAQUE_FIELDS__, its result will be redirected. The common type is str. When a field exists in __FIELD_ADAPTERS__, it will be converted to corresponding python data representation.

To access to the converted value, use a dictionary key as an attribute name. For example, the key receipt is accessible by:

>>> mapper.receipt  # return converted python object Receipt
>>> # == Receipt(mapper['receipt'])

To access to the raw JSON value, use a dictionary key as an attribute name but with the prefix _. For example, the key receipt is accessible by:

>>> mapper._receipt  # return converted python object Receipt
>>> # == mapper['receipt']
Parameters:data (dict) – A JSON object.
Returns:ObjectMapper
class itunesiap.receipt.Response(data)

The root response.

About the value of status:
__DOCUMENTED_FIELDS__ = frozenset({'latest_receipt', 'receipt', 'status', 'latest_receipt_info', 'pending_renewal_info'})
__FIELD_ADAPTERS__ = {'pending_renewal_info': <bound method ObjectMapper.from_list of <class 'itunesiap.receipt.PendingRenewalInfo'>>, 'receipt': <class 'itunesiap.receipt.Receipt'>, 'status': <class 'int'>}
__OPAQUE_FIELDS__ = frozenset({'latest_receipt'})
__UNDOCUMENTED_FIELDS__ = frozenset()
class itunesiap.receipt.Receipt(data)

The actual receipt.

The receipt may hold only one purchase directly in receipt object or may hold multiple purchases in in_app key. This object encapsulate it to list of InApp object in in_app property.

See:https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html
__DOCUMENTED_FIELDS__ = frozenset({'original_application_version', 'is_in_billing_retry_period', 'price_consent_status', 'original_transaction_id', 'quantity', 'app_item_id', 'original_purchase_date', 'auto_renew_product_id', 'cancellation_date', 'product_id', 'expiration_date', 'receipt_creation_date', 'cancellation_reason', 'web_order_line_item_id', 'transaction_id', 'expires_date', 'auto_renew_status', 'is_in_intro_offer_period', 'bundle_id', 'version_external_identifier', 'purchase_date', 'in_app', 'application_version'})
__FIELD_ADAPTERS__ = {'auto_renew_status': <class 'int'>, 'cancellation_date': <function _rfc3339_to_datetime>, 'cancellation_reason': <class 'int'>, 'expiration_date': <function _rfc3339_to_datetime>, 'expiration_date_ms': <class 'int'>, 'expiration_intent': <class 'int'>, 'expires_date': <function _ms_to_datetime>, 'expires_date_ms': ('expires_date', <class 'int'>), 'is_in_billing_retry_period': <function _to_bool>, 'is_in_intro_offer_period': <function _to_bool>, 'original_purchase_date': <function _rfc3339_to_datetime>, 'original_purchase_date_ms': <class 'int'>, 'price_consent_status': <class 'int'>, 'purchase_date': <function _rfc3339_to_datetime>, 'purchase_date_ms': <class 'int'>, 'quantity': <class 'int'>, 'receipt_creation_date': <function _rfc3339_to_datetime>, 'receipt_creation_date_ms': <class 'int'>, 'request_date': <function _rfc3339_to_datetime>, 'request_date_ms': <class 'int'>}
__OPAQUE_FIELDS__ = frozenset({'auto_renew_product_id', 'product_id', 'original_application_version', 'transaction_id', 'bundle_id', 'original_transaction_id', 'expires_date_formatted', 'version_external_identifier', 'app_item_id', 'application_version', 'web_order_line_item_id'})
__UNDOCUMENTED_FIELDS__ = frozenset({'purchase_date_ms', 'original_purchase_date_ms', 'request_date_ms', 'expires_date_formatted', 'version_external_identifier', 'receipt_creation_date_ms', 'unique_identifier', 'expiration_date_ms', 'request_date'})
class itunesiap.receipt.InApp(data)
__DOCUMENTED_FIELDS__ = frozenset({'original_purchase_date', 'cancellation_date', 'product_id', 'transaction_id', 'original_transaction_id', 'purchase_date', 'quantity', 'expires_date', 'cancellation_reason', 'is_trial_period', 'web_order_line_item_id'})
__FIELD_ADAPTERS__ = {'cancellation_date': <function _rfc3339_to_datetime>, 'cancellation_date_ms': <class 'int'>, 'cancellation_reason': <class 'int'>, 'expires_date': <function _rfc3339_to_datetime>, 'expires_date_ms': <class 'int'>, 'is_trial_period': <function _to_bool>, 'original_purchase_date': <function _rfc3339_to_datetime>, 'original_purchase_date_ms': <class 'int'>, 'purchase_date': <function _rfc3339_to_datetime>, 'purchase_date_ms': <class 'int'>, 'quantity': <class 'int'>}
__OPAQUE_FIELDS__ = frozenset({'product_id', 'transaction_id', 'original_transaction_id', 'expires_date_formatted', 'unique_identifier', 'web_order_line_item_id'})
__UNDOCUMENTED_FIELDS__ = frozenset({'purchase_date_ms', 'original_purchase_date_ms', 'expires_date_formatted', 'cancellation_date_ms', 'unique_identifier'})