This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Apple iTunes In-app purchase verification api.

Project Description

Note for v1 users

There was breaking changes between v1 and v2 APIs.

  • Specify version 0.6.6 for latest v1 API when you don’t need new APIs.
  • Or use import itunesiap.legacy as itunesiap instead of import itunesiap. (from itunesiap import xxx to from itunesiap.legacy import xxx)

Quick example

Create request to create a request to itunes verify api.

>>> import itunesiap
>>> try:
>>>     response = itunesiap.verify(raw_data)  # base64-encoded data
>>> except itunesiap.exc.InvalidReceipt as e:
>>>     print('invalid receipt')
>>> print response.receipt.last_in_app.product_id  # other values are also available as property!

Practical 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.

>>> import itunesiap
>>> try:
>>>     response = itunesiap.verify(raw_data, password)  # Just add password
>>> except itunesiap.exc.InvalidReceipt as e:
>>>     print('invalid receipt')
>>> in_app = response.receipt.last_in_app  # Get the latest receipt returned by Apple

Verification policy

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

>>> import itunesiap
>>> with itunesiap.env.review:
>>>     response = itunesiap.verify(raw_data)  # `review` enables both production and sandbox for appstore review. `production`, `sandbox`, `review` or `default` possible.

Or

>>> import itunesiap
>>> itunesiap.env.review.push()  # explicitly pushed context
>>> response = request.verify()

Or

>>> import itunesiap
>>> with itunesiap.env.current().clone(use_sandbox=True):  # additional change for current environment.
>>>     response = itunesiap.verify(raw_data)

Proxy

Put proxy_url for proxies.

>>> import itunesiap
>>> try:
>>>     response = itunesiap.verify(raw_data, proxy_url='https://your.proxy.url/')
>>> except itunesiap.exc.InvalidReceipt as e:
>>>     ...
Release History

Release History

This version
History Node

2.3.0

History Node

2.2.0

History Node

2.1.0

History Node

2.0.1

History Node

2.0.0

History Node

0.7.0

History Node

0.6.6

History Node

0.6.5

History Node

0.6.4

History Node

0.6.3

History Node

0.5.1

History Node

0.5

History Node

0.4.1

History Node

0.4

History Node

0.3

History Node

0.2.1

History Node

0.2

History Node

0.1.2

History Node

0.1.1

History Node

0.1

History Node

0.0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
itunes-iap-2.3.0.tar.gz (8.8 kB) Copy SHA256 Checksum SHA256 Source Jun 29, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting