Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

InApp purchase validation API wrappers

Project Description


In-app purchase validation has never been so friendly and convenient!


pip install pyinapp


Currently pyinapp supports Google Play and App Store receipts validation.

Google Play:

from pyinapp import GooglePlayValidator, InAppValidationError

bundle_id = 'com.yourcompany.yourapp'
api_key = 'API key from the developer console'
validator = GooglePlayValidator(bundle_id, api_key)

    purchases = validator.validate('receipt', 'signature')
except InAppValidationError:
    """ handle validation error """

App Store:

from pyinapp import AppStoreValidator, InAppValidationError

bundle_id = 'com.yourcompany.yourapp'
validator = AppStoreValidator(bundle_id)

    purchases = validator.validate('receipt')
except InAppValidationError:
    """ handle validation error """

Important! If your version is under 0.1.3, you need to check the type of purchases. For the sake of convenience you can process purchases this way:

def process_purchases(purchases):
    process(*purchases) if isinstance(purchases, list) else process(purchases)

def process(*purchases):
    for p in purchases:
        """ for instance, save p to db and add a player some coins for it """

This approach allows to process both Google Play and App Store purchases the same way.


Purchase is a universal wrapper for Google Play and App Store receipts. It contains the following fields:

  • transaction_id: id of the purchase (transaction_id for App Store and orderId for Google Play);
  • product_id: what product has been purchased (product_id for App Store and productId for Google Play);
  • quantity: how many products have been purchased (quantity for App Store and always 1 for Google Play - there’s no such field in Google Play receipt);
  • purchased_at: when the product has been purchased, UNIX timestamp (purchase_date for App Store and purchaseTime for Google Play).
  • response: (App Store only) the response (in JSON format) from the App Store.


To run tests, you’ll need tox. After installing, simply run it:


Release History

This version
History Node


History Node


History Node


History Node


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
(3.5 kB) Copy SHA256 Hash SHA256
Source None Aug 27, 2017

Supported By

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 Google Google Cloud Servers