App Store Server API
Manage your customers’ App Store transactions from your server.
Mentioned in
Overview
The App Store Server API is a REST API that you call from your server to request and provide information about your customers’ In-App Purchases. The App Store signs the transaction and subscription renewal information that this API returns using the JSON Web Signature (JWS) specification. Most endpoints return data for a single customer of your app, indicated by a transaction identifier that you provide.
The App Store Server API is independent of the app’s installation status on the customers’ devices. The App Store server returns information based on a customer’s In-App Purchase history regardless of whether the customer installs, removes, or reinstalls the app on their devices.
This API provides the following functionality:
Transactions and auto-renewable subscription status. Get information for single transactions by calling Get Transaction Info or a customer’s entire transaction history using Get Transaction History. Call Get All Subscription Statuses for up-to-date subscription status. Use this information to keep your customers’ purchase information current on your server.
Refund information. Call Get Refund History to get a customer’s refund history. Use the Send Consumption Information endpoint to send information to the App Store when customers request a refund for an In-App Purchase, after you receive the
CONSUMPTION_REQUESTnotificationType from App Store Server Notifications V2. Your data helps inform refund decisions.App Store Server Notifications history and testing. Call Get Notification History to request the notifications your server may have missed in the past 180 days (or 30 days in the sandbox environment). Call Request a Test Notification and Get Test Notification Status to test if your server is successfully receiving notifications at its App Store Server Notifications V2 endpoint.
Subscription renewal date extensions. Call Extend a Subscription Renewal Date and related endpoints to compensate your customers for temporary service outages, canceled events, or interruptions to live-streamed events by extending the renewal date of their paid, active subscription. For more information, see Extending the renewal date for auto-renewable subscriptions.
Order information lookup. Call Look Up Order ID to get In-App Purchase information based on a customer’s order ID, found on the App Store receipt that customers receive in email.
App transaction information and setting an app account token. Call Get App Transaction Info to get details about the customer’s purchase of your app, such as the original purchase date and version. Use Set App Account Token to set an app account token when your customer makes an In-App Purchase outside your app, or to update its value.
Your server must support the Transport Layer Security (TLS) protocol 1.2 or later to use the App Store Server API.
Check the App Store Server API changelog to learn about the latest changes to this API. Look for videos about the App Store Server API on the Apple Developer website.
Authorize your API calls
Calls to the API require JSON Web Tokens (JWTs) for authorization; you obtain keys to create the tokens from your organization’s App Store Connect account. See Creating API keys to authorize API requests to create your keys. See Generating JSON Web Tokens for API requests to generate tokens using your keys, and send API requests.
After you have a complete and signed token, provide the token in the request’s authorization header as a bearer token. Generate a new token for each new API request, or reuse tokens until they expire.
Create JWTs, verify transactions, and more using the App Store Server Library
The App Store Server Library is an open source library from Apple, available in four languages. It provides a client that make it easier to adopt the App Store Server APIs, including creating the JWTs to authorize calls. For more information, see Simplifying your implementation by using the App Store Server Library and the WWDC23 session Meet the App Store Server Library.
Test using the sandbox environment
All App Store Server API endpoints are available for testing in the sandbox environment, except Look Up Order ID. Access the sandbox environment by sending requests to the endpoints using the following base URL:
https://api.storekit-sandbox.apple.com/For example, to call Get Transaction History in the sandbox environment, send a request using the sandbox URL:
https://api.storekit-sandbox.apple.com/inApps/v2/history/{anyTransactionId}Note that /inApps in the path is case-sensitive.
For endpoints that take a transactionId as a parameter, be sure to call the endpoint using the same environment that creates the transaction identifier. Environment information is present in the environment property of the JWSTransactionDecodedPayload.
If you don’t have environment information, follow these steps:
Call the endpoint using the production URL. If the call succeeds, the transaction identifier belongs to the production environment.
If you receive an error code
4040010TransactionIdNotFoundError, call the endpoint using the sandbox environment.If the call succeeds, the transaction identifier belongs to the sandbox environment. If the call fails with the
4040010error code, the transaction identifier isn’t present in either environment.
Topics
Essentials
Simplifying your implementation by using the App Store Server LibraryCreating API keys to authorize API requestsGenerating JSON Web Tokens for API requestsIdentifying rate limitsApp Store Server API changelog
In-App Purchase history
Transaction information
App Transaction information
Subscription status
App Account Token
Order ID lookup
Finishing transactions
Consumption information
Refund lookup
Subscription-renewal-date extension
Extending the renewal date for auto-renewable subscriptionsExtend a Subscription Renewal DateExtend Subscription Renewal Dates for All Active SubscribersGet Status of Subscription Renewal Date ExtensionsExtendRenewalDateRequestExtendRenewalDateResponseMassExtendRenewalDateRequestMassExtendRenewalDateResponseMassExtendRenewalDateStatusResponse
App Store Server Notifications history
Get Notification HistoryNotificationHistoryRequestNotificationHistoryResponsenotificationHistoryResponseItem
App Store Server Notifications testing
Request a Test NotificationGet Test Notification StatusSendTestNotificationResponseCheckTestNotificationResponse
JWS headers and payloads
JWSDecodedHeaderJWSAppTransactionJWSAppTransactionDecodedPayloadJWSTransactionJWSTransactionDecodedPayloadJWSRenewalInfoJWSRenewalInfoDecodedPayloadData types