Registry / payments / app-store-server-library

app-store-server-library

JSON →
library3.1.2pypypi✓ verified 21d ago

The App Store Server Library is an official Python SDK provided by Apple for interacting with the App Store Server API. It simplifies backend tasks such as validating in-app purchases, retrieving transaction history, managing subscriptions, and checking the status of app purchases. Version 3.0.0 is the latest major release, aligning with the App Store Server API V2, and is actively maintained with updates typically following Apple's API evolution.

pip install app-store-server-library
INSTALL
IMPORT
SIG · APP-STORE-SERVER-L
A
app-store-server-library
paymentspythonv3.1.2
Install
3.6s avg
Import
Disk
41MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.1.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 42.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.6s · import 0.000s · 43MB
41MB installed
● package 41MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AppStoreServerAPIClient
from appstoreserverlibrary import AppStoreServerAPIClient
from appstoreserverlibrary import AppStoreServerAPIClient

Initializes the AppStoreServerAPIClient with credentials from environment variables and demonstrates fetching subscription status using a placeholder original transaction ID. Remember to configure your App Store Connect API Key, Issuer ID, and Bundle ID.

import os from appstoreserverlibrary import AppStoreServerAPIClient, Environment # Ensure these environment variables are set for sandbox or production SIGNING_KEY = os.environ.get("APP_STORE_SIGNING_KEY", "") KEY_ID = os.environ.get("APP_STORE_KEY_ID", "") ISSUER_ID = os.environ.get("APP_STORE_ISSUER_ID", "") BUNDLE_ID = os.environ.get("APP_STORE_BUNDLE_ID", "") # Use SANDBOX for testing, PRODUCTION for live apps ENVIRONMENT = Environment.SANDBOX # or Environment.PRODUCTION if not all([SIGNING_KEY, KEY_ID, ISSUER_ID, BUNDLE_ID]): print("Please set APP_STORE_SIGNING_KEY, APP_STORE_KEY_ID, APP_STORE_ISSUER_ID, and APP_STORE_BUNDLE_ID environment variables.") else: try: client = AppStoreServerAPIClient( signing_key=SIGNING_KEY, key_id=KEY_ID, issuer_id=ISSUER_ID, bundle_id=BUNDLE_ID, environment=ENVIRONMENT ) print("AppStoreServerAPIClient initialized successfully.") # Example: Get subscription status for an original transaction ID # For this to run, replace 'YOUR_ORIGINAL_TRANSACTION_ID' with a real one. original_transaction_id = os.environ.get("APP_STORE_ORIGINAL_TRANSACTION_ID", "") if original_transaction_id: print(f"Fetching subscription status for: {original_transaction_id}") try: status_response = client.get_status_of_subscriptions(original_transaction_id) print(f"Subscription Status: {status_response.to_json()}") except Exception as e: print(f"Error fetching subscription status: {e}") else: print("Set APP_STORE_ORIGINAL_TRANSACTION_ID env var to run subscription status example.") except Exception as e: print(f"Error initializing AppStoreServerAPIClient or making API call: {e}")
app-store-server --version
Debug
Known issues
breakingApple's App Store Server API deprecated the `verify_receipt` endpoint. The App Store Server Library reflects this, and its `AppStoreServerAPIClient` no longer provides a `verify_receipt` method. For individual transactions, use `get_transaction_info` or `get_all_transaction_info`. For broader purchase data, use `get_transaction_history` or `get_status_of_subscriptions`.
fix
Migrate code to use `client.get_transaction_info(transaction_id)` or other relevant V2 endpoints provided by the library.
affects: >=3.0.0
breakingThe `AppStoreServerAPIClient` constructor changed significantly in version 2.0.0 (and is retained in 3.0.0). The `private_key` parameter was renamed to `signing_key`, and the parameter order changed. Ensure you are providing the correct arguments: `(signing_key, key_id, issuer_id, bundle_id, environment)`.
fix
Update client initialization to use `signing_key` and verify parameter order according to the documentation for versions 2.0.0 and above.
affects: <2.0.0 (when migrating to >=2.0.0)
gotchaAlways ensure the `Environment` passed to the `AppStoreServerAPIClient` (e.g., `Environment.SANDBOX` or `Environment.PRODUCTION`) matches the environment where your transactions occurred. Using `SANDBOX` for a production `transaction_id` or vice-versa will result in verification failures (e.g., HTTP 404 Not Found if transaction ID is not found in the specified environment).
fix
Dynamically select the environment based on your application's deployment context or the source of the transaction ID (e.g., check `is_upgraded_from_android_in_app_billing` or other cues).
affects: *
gotchaIncorrectly configured `signing_key`, `key_id`, `issuer_id`, or `bundle_id` will lead to authentication errors (e.g., HTTP 401 Unauthorized or 403 Forbidden). The `signing_key` must be the *content* of the private key (`.p8` file), not a file path. Ensure your bundle ID matches the app associated with the credentials.
fix
Double-check all four credential values against your App Store Connect account (Users and Access -> Keys; ensure the key is active). Load the private key content correctly, for example, by reading the `.p8` file into a string.
affects: *
Upgrade
Version history
3.1.2latest on PyPI · released Jun 1, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
78 hits · last 30 days
node
69
Amazon
1
Perplexity
1
OpenAI (training)
1
Resources
app-store-server-library — pip install app-store-server-library · libregistry