{"id":15036364,"url":"https://github.com/apple/app-store-server-library-python","last_synced_at":"2026-03-13T01:13:00.197Z","repository":{"id":172852759,"uuid":"647516032","full_name":"apple/app-store-server-library-python","owner":"apple","description":"The Python server library for the App Store Server API and App Store Server Notifications.","archived":false,"fork":false,"pushed_at":"2026-02-09T02:04:50.000Z","size":361,"stargazers_count":254,"open_issues_count":12,"forks_count":48,"subscribers_count":21,"default_branch":"main","last_synced_at":"2026-03-07T18:39:33.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apple.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.txt","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-05-31T00:36:01.000Z","updated_at":"2026-02-16T06:31:36.000Z","dependencies_parsed_at":"2023-12-19T02:43:59.926Z","dependency_job_id":"0fedd97b-ae28-4db2-9744-9f2d62d7c874","html_url":"https://github.com/apple/app-store-server-library-python","commit_stats":null,"previous_names":["apple/app-store-server-library-python"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/apple/app-store-server-library-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fapp-store-server-library-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fapp-store-server-library-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fapp-store-server-library-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fapp-store-server-library-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apple","download_url":"https://codeload.github.com/apple/app-store-server-library-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fapp-store-server-library-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30452955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T21:31:01.033Z","status":"ssl_error","status_checked_at":"2026-03-12T21:30:43.161Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T20:30:55.998Z","updated_at":"2026-03-13T01:13:00.154Z","avatar_url":"https://github.com/apple.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apple App Store Server Python Library\nThe [Python](https://github.com/apple/app-store-server-library-python) server library for the [App Store Server API](https://developer.apple.com/documentation/appstoreserverapi) and [App Store Server Notifications](https://developer.apple.com/documentation/appstoreservernotifications). Also available in [Swift](https://github.com/apple/app-store-server-library-swift), [Node.js](https://github.com/apple/app-store-server-library-node), and [Java](https://github.com/apple/app-store-server-library-java).\n\n## Table of Contents\n1. [Installation](#installation)\n2. [Documentation](#documentation)\n3. [Usage](#usage)\n4. [Support](#support)\n\n## Installation\n\n#### Requirements\n\n- Python 3.8+\n\n### pip\n```sh\npip install app-store-server-library\n```\n\n## Documentation\n\n[Documentation](https://apple.github.io/app-store-server-library-python/)\n\n[WWDC Video](https://developer.apple.com/videos/play/wwdc2023/10143/)\n\n### Obtaining an In-App Purchase key from App Store Connect\n\nTo use the App Store Server API or create promotional offer signatures, a signing key downloaded from App Store Connect is required. To obtain this key, you must have the Admin role. Go to Users and Access \u003e Integrations \u003e In-App Purchase. Here you can create and manage keys, as well as find your issuer ID. When using a key, you'll need the key ID and issuer ID as well.\n\n### Obtaining Apple Root Certificates\n\nDownload and store the root certificates found in the Apple Root Certificates section of the [Apple PKI](https://www.apple.com/certificateauthority/) site. Provide these certificates as an array to a SignedDataVerifier to allow verifying the signed data comes from Apple.\n\n## Usage\n\n### API Usage\n\n```python\nfrom appstoreserverlibrary.api_client import AppStoreServerAPIClient, APIException\nfrom appstoreserverlibrary.models.Environment import Environment\n\nprivate_key = read_private_key(\"/path/to/key/SubscriptionKey_ABCDEFGHIJ.p8\") # Implementation will vary\n\nkey_id = \"ABCDEFGHIJ\"\nissuer_id = \"99b16628-15e4-4668-972b-eeff55eeff55\"\nbundle_id = \"com.example\"\nenvironment = Environment.SANDBOX\n\nclient = AppStoreServerAPIClient(private_key, key_id, issuer_id, bundle_id, environment)\n\ntry:    \n    response = client.request_test_notification()\n    print(response)\nexcept APIException as e:\n    print(e)\n```\n\n### Verification Usage\n\n```python\nfrom appstoreserverlibrary.models.Environment import Environment\nfrom appstoreserverlibrary.signed_data_verifier import VerificationException, SignedDataVerifier\n\nroot_certificates = load_root_certificates()\nenable_online_checks = True\nbundle_id = \"com.example\"\nenvironment = Environment.SANDBOX\napp_apple_id = None # appAppleId must be provided for the Production environment\nsigned_data_verifier = SignedDataVerifier(root_certificates, enable_online_checks, environment, bundle_id, app_apple_id)\n\ntry:    \n    signed_notification = \"ey..\"\n    payload = signed_data_verifier.verify_and_decode_notification(signed_notification)\n    print(payload)\nexcept VerificationException as e:\n    print(e)\n```\n\n### Receipt Usage\n\n```python\nfrom appstoreserverlibrary.api_client import AppStoreServerAPIClient, APIException, GetTransactionHistoryVersion\nfrom appstoreserverlibrary.models.Environment import Environment\nfrom appstoreserverlibrary.receipt_utility import ReceiptUtility\nfrom appstoreserverlibrary.models.HistoryResponse import HistoryResponse\nfrom appstoreserverlibrary.models.TransactionHistoryRequest import TransactionHistoryRequest, ProductType, Order\n\nprivate_key = read_private_key(\"/path/to/key/SubscriptionKey_ABCDEFGHIJ.p8\") # Implementation will vary\n\nkey_id = \"ABCDEFGHIJ\"\nissuer_id = \"99b16628-15e4-4668-972b-eeff55eeff55\"\nbundle_id = \"com.example\"\nenvironment = Environment.SANDBOX\n\nclient = AppStoreServerAPIClient(private_key, key_id, issuer_id, bundle_id, environment)\nreceipt_util = ReceiptUtility()\napp_receipt = \"MI..\"\n\ntry:    \n    transaction_id = receipt_util.extract_transaction_id_from_app_receipt(app_receipt)\n    if transaction_id != None:\n        transactions = []\n        response: HistoryResponse = None\n        request: TransactionHistoryRequest = TransactionHistoryRequest(\n            sort=Order.ASCENDING,\n            revoked=False,\n            productTypes=[ProductType.AUTO_RENEWABLE]\n        )\n        while response == None or response.hasMore:\n            revision = response.revision if response != None else None\n            response = client.get_transaction_history(transaction_id, revision, request, GetTransactionHistoryVersion.V2)\n            for transaction in response.signedTransactions:\n                transactions.append(transaction)\n        print(transactions)\nexcept APIException as e:\n    print(e)\n\n```\n\n### Promotional Offer Signature Creation\n\n```python\nfrom appstoreserverlibrary.promotional_offer import PromotionalOfferSignatureCreator\nimport time\n\nprivate_key = read_private_key(\"/path/to/key/SubscriptionKey_ABCDEFGHIJ.p8\") # Implementation will vary\n\nkey_id = \"ABCDEFGHIJ\"\nbundle_id = \"com.example\"\n\npromotion_code_signature_generator = PromotionalOfferSignatureCreator(private_key, key_id, bundle_id)\n\nproduct_id = \"\u003cproduct_id\u003e\"\nsubscription_offer_id = \"\u003csubscription_offer_id\u003e\"\napplication_username = \"\u003capplication_username\u003e\"\nnonce = \"\u003cnonce\u003e\"\ntimestamp = round(time.time()*1000)\nbase64_encoded_signature = promotion_code_signature_generator.create_signature(product_id, subscription_offer_id, application_username, nonce, timestamp)\n```\n\n### Async HTTPX Support\n\n#### Pip\nInclude the optional async dependency\n```sh\npip install app-store-server-library[async]\n```\n\n#### API Usage\n```python\nfrom appstoreserverlibrary.api_client import AsyncAppStoreServerAPIClient, APIException\nfrom appstoreserverlibrary.models.Environment import Environment\n\nprivate_key = read_private_key(\"/path/to/key/SubscriptionKey_ABCDEFGHIJ.p8\") # Implementation will vary\n\nkey_id = \"ABCDEFGHIJ\"\nissuer_id = \"99b16628-15e4-4668-972b-eeff55eeff55\"\nbundle_id = \"com.example\"\nenvironment = Environment.SANDBOX\n\nclient = AsyncAppStoreServerAPIClient(private_key, key_id, issuer_id, bundle_id, environment)\n\ntry:    \n    response = await client.request_test_notification()\n    print(response)\nexcept APIException as e:\n    print(e)\n\n# Once client use is finished\nawait client.async_close()\n```\n\n## Support\n\nOnly the latest major version of the library will receive updates, including security updates. Therefore, it is recommended to update to new major versions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapple%2Fapp-store-server-library-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapple%2Fapp-store-server-library-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapple%2Fapp-store-server-library-python/lists"}