This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

pyinapp

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

Installation

pip install pyinapp

Usage

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)

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

App Store:

from pyinapp import AppStoreValidator, InAppValidationError


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

try:
    purchase = validator.validate('receipt')
    process_purchase(purchase)
except InAppValidationError:
    """ handle validation error """

Important! On iOS 7+ all receipts may contain more than one purchase so you have to deal with a list of purchases. For the sake of convenience you can process purchases this way:

def process_purchase(purchase):
    process(*purchase) if isinstance(purchase, list) else process(purchase)


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

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).
Release History

Release History

0.1.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyinapp-0.1.2.tar.gz (3.3 kB) Copy SHA256 Checksum SHA256 Source Nov 13, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development 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