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({'pending_renewal_info', 'receipt', 'latest_receipt', 'status', 'latest_receipt_info'})¶
-
__FIELD_ADAPTERS__
= {'receipt': <class 'itunesiap.receipt.Receipt'>, 'status': <class 'int'>, 'pending_renewal_info': <bound method ObjectMapper.from_list of <class 'itunesiap.receipt.PendingRenewalInfo'>>}¶
-
__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.-
__DOCUMENTED_FIELDS__
= frozenset({'application_version', 'in_app', 'original_application_version', 'receipt_creation_date_ms', 'receipt_expiration_date', 'app_item_id', 'bundle_id', 'receipt_expiration_date_ms', 'version_external_identifier', 'receipt_creation_date'})¶
-
__FIELD_ADAPTERS__
= {'request_date_ms': <class 'int'>, 'original_purchase_date_ms': <class 'int'>, 'receipt_expiration_date': <function _to_datetime>, 'original_purchase_date': <function _to_datetime>, 'receipt_expiration_date_ms': <class 'int'>, 'receipt_creation_date': <function _to_datetime>, 'request_date': <function _to_datetime>, 'receipt_creation_date_ms': <class 'int'>}¶
-
__OPAQUE_FIELDS__
= frozenset({'bundle_id', 'version_external_identifier', 'application_version', 'original_application_version', 'app_item_id'})¶
-
__UNDOCUMENTED_FIELDS__
= frozenset({'original_purchase_date', 'request_date', 'version_external_identifier', 'request_date_ms', 'original_purchase_date_ms'})¶
-
-
class
itunesiap.receipt.
InApp
(data)¶ -
__DOCUMENTED_FIELDS__
= frozenset({'cancellation_date', 'original_transaction_id', 'expires_date', 'product_id', 'original_purchase_date', 'purchase_date', 'quantity', 'cancellation_date_ms', 'cancellation_reason', 'web_order_line_item_id', 'transaction_id', 'original_purchase_date_ms', 'purchase_date_ms', 'is_trial_period', 'expires_date_ms'})¶
-
__FIELD_ADAPTERS__
= {'cancellation_date': <function _to_datetime>, 'expires_date': <function _to_datetime>, 'cancellation_reason': <class 'int'>, 'original_purchase_date': <function _to_datetime>, 'quantity': <class 'int'>, 'purchase_date': <function _to_datetime>, 'cancellation_date_ms': <class 'int'>, 'original_purchase_date_ms': <class 'int'>, 'purchase_date_ms': <class 'int'>, 'is_trial_period': <function _to_bool>, 'expires_date_ms': <class 'int'>, 'expires_date_formatted': <function _to_datetime>}¶
-
__OPAQUE_FIELDS__
= frozenset({'original_transaction_id', 'product_id', 'unique_identifier', 'transaction_id', 'web_order_line_item_id'})¶
-
__UNDOCUMENTED_FIELDS__
= frozenset({'unique_identifier', 'expires_date_formatted'})¶
-