Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Apple iTunes In-app purchase verification api.

Project description

itunes-iap
~~~~~~~~~~

Quick example
-------------

Create request to create a request to itunes verify api.

>>> from itunesiap import Request, InvalidReceipt
>>> request = Request(raw_data) # base64-encoded data
>>> try:
>>> receipt = request.verify()
>>> except InvalidReceipt as e:
>>> print 'invalid receipt'
>>> print receipt.product_id # any other values are available as property!

Practical useful values are: product_id, original_transaction_id, quantity, unique_identifier

Quick example with password (Apple Shared Secret)
-------------

Create request to create a request to itunes verify api.

>>> from itunesiap import Request, InvalidReceipt
>>> request = Request(raw_data, password) # base64-encoded data
>>> try:
>>> receipt = request.verify()
>>> except InvalidReceipt as e:
>>> print 'invalid receipt'
>>> print receipt.product_id # any other values are available as property!
>>> print receipt.latest_receipt # Get the latest receipt returned by Apple


Verification policy
-------------------

Set verification mode for production or sandbox api. Review mode also available for appstore review.

>>> from itunesiap import Request
>>> with request.verification_mode('review'): # enable both production and sandbox for appstore review. 'production', 'sandbox' or 'review'
>>> receipt = Request(raw_data).verify()

Workflow Shortcut
-----------------

>>> def test_paid(original_transaction_id):
>>> if db.contains(original_transaction_id):
>>> raise CustomException # custom exception
>>>
>>> import itunesiap
>>> try:
>>> response = itunesiap.verify(raw_data, test_paid)
>>> except itunesiap.RequestError:
>>> pass
>>> except CustomException:
>>> pass
>>> # response is instance of `itunesiap.core.Response`


Forked from https://github.com/youknowone/itunes-iap

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
itunes-iap2-0.6.2.2.macosx-10.10-x86_64.tar.gz (4.0 kB) Copy SHA256 hash SHA256 Dumb Binary any Feb 17, 2015
itunes_iap2-0.6.2.2-py2.7.egg (5.0 kB) Copy SHA256 hash SHA256 Egg 2.7 Feb 17, 2015
itunes-iap2-0.6.2.2.tar.gz (5.2 kB) Copy SHA256 hash SHA256 Source None Feb 17, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page