A Go port of the Apple App Store Server Library.
This library provides a Go implementation for interacting with the App Store Server API, App Store Server Notifications, and Retention Messaging API.
go get github.com/laishere/app-store-server-library-goTo 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 > Integrations > 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.
Download and store the root certificates found in the Apple Root Certificates section of the Apple PKI site. Provide these certificates as an array to a SignedDataVerifier to allow verifying the signed data comes from Apple.
For more detailed examples, see the examples directory.
signingKey, _ := os.ReadFile("SubscriptionKey_ABCD123456.p8")
client, _ := appstore.NewAPIClient(signingKey, "ABCD123456", "issuer_id", "com.example", appstore.ENVIRONMENT_SANDBOX)
response, err := client.RequestTestNotification()rootCert, _ := os.ReadFile("AppleRootCA-G3.cer")
verifier, _ := appstore.NewSignedDataVerifier([][]byte{rootCert}, true, appstore.ENVIRONMENT_SANDBOX, "com.example", 123456789)
payload, err := verifier.VerifyAndDecodeNotification(signedPayload)utility := appstore.NewReceiptUtility()
transactionId, err := utility.ExtractTransactionIdFromAppReceipt(appReceipt)creator, _ := appstore.NewPromotionalOfferV2SignatureCreator(signingKey, "keyId", "issuerId", "bundleId")
signature, err := creator.CreateSignature(productID, offerIdentifier, nil)- App Store Server API Client: Complete implementation of the App Store Server API endpoints
- Transaction history and subscription status
- Order lookup and refund history
- Test notifications
- Consumption information
- Subscription renewal date extensions
- Notification history
- App Store Server Notifications: Verify and decode App Store Server Notifications V2
- Retention Messaging API: Upload and manage retention messaging images and messages
- Receipt Utility: Extract transaction IDs from App Receipts and transactional receipts
- Signed Data Verification: Verify and decode JWS signed data from the App Store
- Signature Creators: Generate signatures for various use cases
- Promotional Offer V2 signatures
- Introductory offer eligibility signatures
- Advanced Commerce API in-app signatures
This project is licensed under the MIT License - see the LICENSE file for details. Portions copyright (c) 2023 Apple Inc.