Manage in-app purchases for Apple AppStore and Google Play
Project description
# inapp-purchases
Manage in-app purchases for Apple AppStore and Google Play
[![PyPI version](https://badge.fury.io/py/inapp-purchases.svg)](https://badge.fury.io/py/inapp-purchases)
[![Code Health](https://landscape.io/github/adanmauri/inapp-purchases/master/landscape.svg?style=flat)](https://landscape.io/github/adanmauri/inapp-purchases/master)
## Installation
```shell
pip install inapp-purchases
```
## Usage
Currently inapp-purchases supports Google Play and App Store subscription services. But, product purchases is available retrieving raw data.
### Google Play:
```python
from inapp_purchases.google_play import GooglePlayService
service = GooglePlayService(
service_account_file='service-info.json',
# or service_account_info='service-info.json'
package_name='com.package.name'
)
purchase = service.get_subscription_purchase(
subscription_id='com.subscription.id',
token='purchase-token'
)
```
### AppStore:
```python
from inapp_purchases.app_store import AppStoreService
service = AppStoreService(
sandbox=True,
password='secret-password'
)
purchase = service.get_subscription_purchase(
receipt_data='receive-hash'
)
```
## Response
```python
{
'bundle_id': unicode,
'subscription_id': unicode,
'purchase_id': unicode,
'original_purchase_id': unicode,
'purchase_date_ms': int,
'original_purchase_date_ms': int,
'auto_renewing': bool,
'expires_date_ms': int,
'country_code': unicode,
'price_currency_code': unicode,
'price_amount': float,
'cancellation_date_ms': int,
'cancellation_reason': unicode,,
'payment_state': int,
'status': unicode,
'is_active': bool,
'is_trial_period': bool,
'expiration_intent': unicode,
}
```
## TODO
- Exceptions
- Google Play products data response (the raw content is returned)
- AppStore products data response (the raw content is returned)
- Get list of products from AppStore
- Tests
- Retrieve more information from the services
- Documentation
- Examples
Manage in-app purchases for Apple AppStore and Google Play
[![PyPI version](https://badge.fury.io/py/inapp-purchases.svg)](https://badge.fury.io/py/inapp-purchases)
[![Code Health](https://landscape.io/github/adanmauri/inapp-purchases/master/landscape.svg?style=flat)](https://landscape.io/github/adanmauri/inapp-purchases/master)
## Installation
```shell
pip install inapp-purchases
```
## Usage
Currently inapp-purchases supports Google Play and App Store subscription services. But, product purchases is available retrieving raw data.
### Google Play:
```python
from inapp_purchases.google_play import GooglePlayService
service = GooglePlayService(
service_account_file='service-info.json',
# or service_account_info='service-info.json'
package_name='com.package.name'
)
purchase = service.get_subscription_purchase(
subscription_id='com.subscription.id',
token='purchase-token'
)
```
### AppStore:
```python
from inapp_purchases.app_store import AppStoreService
service = AppStoreService(
sandbox=True,
password='secret-password'
)
purchase = service.get_subscription_purchase(
receipt_data='receive-hash'
)
```
## Response
```python
{
'bundle_id': unicode,
'subscription_id': unicode,
'purchase_id': unicode,
'original_purchase_id': unicode,
'purchase_date_ms': int,
'original_purchase_date_ms': int,
'auto_renewing': bool,
'expires_date_ms': int,
'country_code': unicode,
'price_currency_code': unicode,
'price_amount': float,
'cancellation_date_ms': int,
'cancellation_reason': unicode,,
'payment_state': int,
'status': unicode,
'is_active': bool,
'is_trial_period': bool,
'expiration_intent': unicode,
}
```
## TODO
- Exceptions
- Google Play products data response (the raw content is returned)
- AppStore products data response (the raw content is returned)
- Get list of products from AppStore
- Tests
- Retrieve more information from the services
- Documentation
- Examples
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
inapp-purchases-0.4.1.tar.gz
(5.2 kB
view hashes)
Built Distributions
Close
Hashes for inapp_purchases-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c172820f07226e1f038197ad2f54d8e716477c1e0cb14d37e97186722654fc28 |
|
MD5 | ff29cddf1665d6a94166cdf46eb3bf13 |
|
BLAKE2b-256 | a564cef7ecb34813a9130651e3c4dd6dd7488299491243df81838283cbbdf1d2 |
Close
Hashes for inapp_purchases-0.4.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0e0f0633123a09e6b7283857ff82303147c3cfef87b06bc722c8206a23e22a2 |
|
MD5 | 1eb84dbf7282854fea57153cb25f2e03 |
|
BLAKE2b-256 | 42b9cdea7910fbc80eb70e89071902bd294c28debb2ac299f4f56f67fa15c965 |