# inapp-purchases
Manage in-app purchases for Apple AppStore and Google Play
[](https://badge.fury.io/py/inapp-purchases)
[](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
[](https://badge.fury.io/py/inapp-purchases)
[](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
Metadata
Release files for inapp-purchases 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| inapp-purchases-0.4.2.tar.gz | 5.2 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| inapp_purchases-0.4.2-py3-none-any.whl | Python 3 | none | any | Details |
| inapp_purchases-0.4.2-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 22.1 kB
Release files / inapp-purchases-0.4.2.tar.gz
| Download URL | inapp-purchases-0.4.2.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
368b2de54def301b47fb66a91fde98753a695fbe8c6edbca10f64dd258f58802
|
|
BLAKE2b-256 checksum How to use checksums |
90deabac32ca3a37d4585ae4e4a4d79ee574979aa1acf6b524f1969191f06005
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.12.4 setuptools/33.1.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.13
|
Release files / inapp_purchases-0.4.2-py3-none-any.whl
| Download URL | inapp_purchases-0.4.2-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c4acb48ca676506505013526b23d33e3936cebf6bdf01a15aebf4ed60a66c15
|
|
BLAKE2b-256 checksum How to use checksums |
b6feb515e441973d07d04dad4f35c97eb05dfd6f63818c25ffb09c1923917ddb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.12.4 setuptools/33.1.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.13
|
Release files / inapp_purchases-0.4.2-py2-none-any.whl
| Download URL | inapp_purchases-0.4.2-py2-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
673ee53d31219660092086884f6b489853697373a3e5f3a654564083bac5d3d1
|
|
BLAKE2b-256 checksum How to use checksums |
2227e02e0966a7e39b7c95948b83c3b08f376e002467418da68b322ed990a611
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.12.4 setuptools/33.1.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.13
|