Contents

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:

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:

  1. Call the endpoint using the production URL. If the call succeeds, the transaction identifier belongs to the production environment.

  2. If you receive an error code 4040010 TransactionIdNotFoundError, call the endpoint using the sandbox environment.

  3. If the call succeeds, the transaction identifier belongs to the sandbox environment. If the call fails with the 4040010 error code, the transaction identifier isn’t present in either environment.

Topics

Essentials

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

App Store Server Notifications history

App Store Server Notifications testing

JWS headers and payloads

Error information

Deprecated