PHPackages                             nullform/app-store-server-api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. nullform/app-store-server-api-client

ActiveLibrary[API Development](/categories/api)

nullform/app-store-server-api-client
====================================

PHP client for App Store Server API and App Store Server Notifications

v2.0.1(2mo ago)131.3k↓50%6MITPHPPHP ^8.0

Since Jan 22Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/nullform/app-store-server-api-client)[ Packagist](https://packagist.org/packages/nullform/app-store-server-api-client)[ Docs](https://github.com/nullform/app-store-server-api-client)[ RSS](/packages/nullform-app-store-server-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (10)Versions (10)Used By (0)

Apple App Store Server API PHP Client
=====================================

[](#apple-app-store-server-api-php-client)

Unoffical PHP client for [App Store Server API](https://developer.apple.com/documentation/appstoreserverapi) and [App Store Server Notifications](https://developer.apple.com/documentation/appstoreservernotifications).

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- PHP &gt;= 8.0

### Composer

[](#composer)

```
composer require nullform/app-store-server-api-client
```

Usage
-----

[](#usage)

Create an API Key instance:

```
// As instance of anonymous class...
$apiKey = new class extends AbstractApiKey {};
$apiKey->setPrivateKey(\file_get_contents($privateKeyFile));
$apiKey->setPrivateKeyId('Your private key id');
$apiKey->setIssuerId('Your issuer id');
$apiKey->setName('Key name (optional)');

// ... or as instance of ApiKey
$apiKey = new ApiKey(
    \file_get_contents($privateKeyFile),
    'Your private key id',
    'Your issuer id',
    'Key name (optional)'
);
```

Create a Bundle instance(s):

```
// As instance of anonymous class...
$bundle = new class extends AbstractBundle {};
$bundle->setBundleId('Your bundle id');
$bundle->setName('Bundle name (optional)');

// ... or as instance of Bundle
$bundle2 = new Bundle('Your bundle #2 id');
```

Create an API client instance:

```
$client = new AppStoreServerApiClient($apiKey, $bundle, Environment::PRODUCTION);
```

Use client for one or multiple bundles:

```
try {
    $historyResponse = $client->getTransactionHistory($originalTransactionId);
    $transactions = $historyResponse->getDecodedTransactions();
} catch (HttpClientException $httpClientException) {
    echo "HTTP client error: " . $httpClientException->getMessage();
} catch (AppleException $appleException) {
    echo "Apple error ({$appleException->getCode()}): " . $appleException->getMessage();
}

try {
    $bundle2HistoryResponse = $client->setBundle($bundle2)->getTransactionHistory($originalTransactionId);
} catch (\Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

You can manually call the App Store Server API via universal **callApi()** method:

```
use Nullform\AppStoreServerApiClient\AppStoreServerApiClient;
use Nullform\AppStoreServerApiClient\AbstractModel;
use Nullform\AppStoreServerApiClient\Environment;

$apiKey = new MyApiKey(); // Extends AbstractApiKey
$bundle = new MyBundle(); // Extends AbstractBundle
$client = new AppStoreServerApiClient($apiKey, $bundle, Environment::SANDBOX);

$queryParams = new class extends AbstractModel {
    public $param = 'value';
};
$requestBody = new class extends AbstractModel {
    public $bodyParam = 'value';
};

// Get instance of ResponseInterface
$response = $client->callApi("POST", "inApps/v1/notifications/test", $queryParams, $requestBody);
// Get response body
$responseBody = $response->getBody()->getContents();
```

AppStoreServerApiClient methods
-------------------------------

[](#appstoreserverapiclient-methods)

### Get Transaction History

[](#get-transaction-history)

```
AppStoreServerApiClient::getTransactionHistory(
    string $transactionId,
    null|string|GetTransactionHistoryParams $paramsOrRevision = null
): HistoryResponse
```

Get a customer’s in-app purchase transaction history for your app.

[https://developer.apple.com/documentation/appstoreserverapi/get\_transaction\_history](https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history)

### Get All Transactions History

[](#get-all-transactions-history)

```
AppStoreServerApiClient::getAllTransactionHistory(
    string $transactionId
): JWSTransactionDecodedPayload[]
```

Recursively get FULL transaction history.

### Get Transaction Info

[](#get-transaction-info)

```
AppStoreServerApiClient::getTransactionInfo(
    string $transactionId
): TransactionInfoResponse
```

Get information about a single transaction for your app.

[https://developer.apple.com/documentation/appstoreserverapi/get\_transaction\_info](https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info)

### Get All Subscription Statuses

[](#get-all-subscription-statuses)

```
AppStoreServerApiClient::getAllSubscriptionStatuses(
    string $transactionId
): StatusResponse
```

Get the statuses for all of a customer’s subscriptions in your app.

[https://developer.apple.com/documentation/appstoreserverapi/get\_all\_subscription\_statuses](https://developer.apple.com/documentation/appstoreserverapi/get_all_subscription_statuses)

### Send Consumption Information

[](#send-consumption-information)

```
AppStoreServerApiClient::sendConsumptionInformation(
    string $transactionId,
    ConsumptionRequest $request
): void
```

Send consumption information about a consumable in-app purchase to the App Store after your server receives a consumption request notification.

[https://developer.apple.com/documentation/appstoreserverapi/send\_consumption\_information](https://developer.apple.com/documentation/appstoreserverapi/send_consumption_information)

### Look Up Order Id

[](#look-up-order-id)

```
AppStoreServerApiClient::lookUpOrderId(
    string $orderId
): OrderLookupResponse
```

Get a customer’s in-app purchases from a receipt using the order ID.

[https://developer.apple.com/documentation/appstoreserverapi/look\_up\_order\_id](https://developer.apple.com/documentation/appstoreserverapi/look_up_order_id)

### Get Refund History

[](#get-refund-history)

```
AppStoreServerApiClient::getRefundHistory(
    string $transactionId
): RefundLookupResponse
```

Get a list of all refunded in-app purchases in your app for a customer.

[https://developer.apple.com/documentation/appstoreserverapi/get\_refund\_history](https://developer.apple.com/documentation/appstoreserverapi/get_refund_history)

### Extend a Subscription Renewal Date

[](#extend-a-subscription-renewal-date)

```
AppStoreServerApiClient::extendSubscriptionRenewalDate(
    string $originalTransactionId,
    ExtendRenewalDateRequest $request
): ExtendRenewalDateResponse
```

Extend the renewal date of a customer’s active subscription using the original transaction identifier.

[https://developer.apple.com/documentation/appstoreserverapi/extend\_a\_subscription\_renewal\_date](https://developer.apple.com/documentation/appstoreserverapi/extend_a_subscription_renewal_date)

### Extend Subscription Renewal Dates for All Active Subscribers

[](#extend-subscription-renewal-dates-for-all-active-subscribers)

```
AppStoreServerApiClient::extendSubscriptionRenewalDatesForAllActiveSubscribers(
    MassExtendRenewalDateRequest $request
): MassExtendRenewalDateResponse
```

Uses a subscription’s product identifier to extend the renewal date for all of its eligible active subscribers.

[https://developer.apple.com/documentation/appstoreserverapi/extend\_subscription\_renewal\_dates\_for\_all\_active\_subscribers](https://developer.apple.com/documentation/appstoreserverapi/extend_subscription_renewal_dates_for_all_active_subscribers)

### Get Status of Subscription Renewal Date Extensions

[](#get-status-of-subscription-renewal-date-extensions)

```
AppStoreServerApiClient::getStatusOfSubscriptionRenewalDateExtensions(
    string $productId,
    string $requestIdentifier
): MassExtendRenewalDateStatusResponse
```

Checks whether a renewal date extension request completed, and provides the final count of successful or failed extensions.

[https://developer.apple.com/documentation/appstoreserverapi/get\_status\_of\_subscription\_renewal\_date\_extensions](https://developer.apple.com/documentation/appstoreserverapi/get_status_of_subscription_renewal_date_extensions)

### Request a Test Notification

[](#request-a-test-notification)

```
AppStoreServerApiClient::requestTestNotification(): SendTestNotificationResponse
```

Ask App Store Server Notifications to send a test notification to your server.

[https://developer.apple.com/documentation/appstoreserverapi/request\_a\_test\_notification](https://developer.apple.com/documentation/appstoreserverapi/request_a_test_notification)

### Get Test Notification Status

[](#get-test-notification-status)

```
AppStoreServerApiClient::getTestNotificationStatus(
    string $testNotificationToken
): CheckTestNotificationResponse
```

Check the status of the test App Store server notification sent to your server.

[https://developer.apple.com/documentation/appstoreserverapi/get\_test\_notification\_status](https://developer.apple.com/documentation/appstoreserverapi/get_test_notification_status)

### Get Notification History

[](#get-notification-history)

```
AppStoreServerApiClient::getNotificationHistory(
    NotificationHistoryRequest $params,
    ?string $paginationToken = null
): CheckTestNotificationResponse
```

Get a list of notifications that the App Store server attempted to send to your server.

[https://developer.apple.com/documentation/appstoreserverapi/get\_notification\_history](https://developer.apple.com/documentation/appstoreserverapi/get_notification_history)

### Set App Store Bundle

[](#set-app-store-bundle)

```
AppStoreServerApiClient::setBundle(
    BundleInterface $bundle
): self
```

Set App Store bundle for authorize your API calls.

### Set Token TTL

[](#set-token-ttl)

```
AppStoreServerApiClient::setTokenTtl(
    int $ttl
): self
```

Set new value for JWT TTL (in seconds). Maximum value: 3600.

[https://developer.apple.com/documentation/appstoreserverapi/generating\_tokens\_for\_api\_requests](https://developer.apple.com/documentation/appstoreserverapi/generating_tokens_for_api_requests)

### Set HTTP Client Request Timeout

[](#set-http-client-request-timeout)

```
AppStoreServerApiClient::setHttpClientRequestTimeout(
    float $timeout
): self
```

Set new value for HTTP client request timeout (in seconds).

### Call API

[](#call-api)

```
AppStoreServerApiClient::callApi(
    string $method,
    string $path,
    ?AbstractModel $params = null,
    ?AbstractModel $body = null
): \Psr\Http\Message\ResponseInterface
```

Custom call App Store Server API with your previously passed credentials.

Receiving App Store Server Notifications V2
-------------------------------------------

[](#receiving-app-store-server-notifications-v2)

To receive [App Store Server Notifications](https://developer.apple.com/documentation/appstoreservernotifications)use **AppStoreServerNotificationsClient**:

```
$notificationClient = new AppStoreServerNotificationsClient();

try {
    $payload = $notificationClient->receive($requestBody);
} catch (NotificationBadRequestException $exception) {
    echo $exception->getMessage();
}
```

Note that AppStoreServerNotificationsClient only for version 2 notifications.

Tests
-----

[](#tests)

For unit tests you must create *credentials.php* and *private-key.p8* with the key and sandbox credentials from App Store Connect (see *tests/credentials.example.php*).

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance86

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 92.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~188 days

Recently: every ~28 days

Total

9

Last Release

74d ago

Major Versions

v1.1.6 → v2.0.02026-03-06

v1.x-dev → v2.0.12026-03-06

PHP version history (3 changes)v1.0.0PHP ^7.2

v1.1.0PHP ^7.2||^8.0

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/04a9894c87cf7ea2b58fc41be2ebbb1a999e1906d209e146b0fc2fd9dd9b7b2e?d=identicon)[nullform](/maintainers/nullform)

---

Top Contributors

[![nullform](https://avatars.githubusercontent.com/u/4964609?v=4)](https://github.com/nullform "nullform (35 commits)")[![srjlewis](https://avatars.githubusercontent.com/u/56001?v=4)](https://github.com/srjlewis "srjlewis (2 commits)")[![tanghengzhi](https://avatars.githubusercontent.com/u/2969338?v=4)](https://github.com/tanghengzhi "tanghengzhi (1 commits)")

---

Tags

app-store-server-apiapp-store-server-notificationsphpitunesappleapp\_storeApp Store Server APIapp store server notifications

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nullform-app-store-server-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/nullform-app-store-server-api-client/health.svg)](https://phpackages.com/packages/nullform-app-store-server-api-client)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[get-stream/stream

A PHP client for Stream (https://getstream.io)

1451.3M8](/packages/get-stream-stream)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[agence104/livekit-server-sdk

Server-side SDK for LiveKit.

79189.9k1](/packages/agence104-livekit-server-sdk)[packbackbooks/lti-1p3-tool

A library used for building IMS-certified LTI 1.3 tool providers in PHP.

51438.3k2](/packages/packbackbooks-lti-1p3-tool)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
