PHPackages                             zaboday/store-receipt-validator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. zaboday/store-receipt-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

zaboday/store-receipt-validator
===============================

Fork of aporat PHP library that can be used to validate base64 encoded iTunes in app purchase receipts.

1.5.3(3y ago)159Apache-2.0PHPPHP &gt;=5.5

Since Aug 8Pushed 3y agoCompare

[ Source](https://github.com/Zaboday/store-receipt-validator)[ Packagist](https://packagist.org/packages/zaboday/store-receipt-validator)[ Docs](https://github.com/Zaboday/store-receipt-validator)[ RSS](/packages/zaboday-store-receipt-validator/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (4)Versions (26)Used By (0)

store-receipt-validator
=======================

[](#store-receipt-validator)

[![Latest Stable Version](https://camo.githubusercontent.com/26b3a55ae1269bb8842d74e649fa78a84e2b2f4d58eff4568dd9053ee3f4a7ef/68747470733a2f2f706f7365722e707567782e6f72672f61706f7261742f73746f72652d726563656970742d76616c696461746f722f76657273696f6e2e706e67)](https://packagist.org/packages/aporat/store-receipt-validator) [![Composer Downloads](https://camo.githubusercontent.com/653797ad41f82a7e741f1bec0b24facd9d4c9e8d2be0e1a795b234905a6cc05f/68747470733a2f2f706f7365722e707567782e6f72672f61706f7261742f73746f72652d726563656970742d76616c696461746f722f642f746f74616c2e706e67)](https://packagist.org/packages/aporat/store-receipt-validator)[![Build Status](https://camo.githubusercontent.com/de602f78a2b4cd6f4be4154f34b8eeee19c491829a3e922055a6d7cfca12d931/68747470733a2f2f7472617669732d63692e6f72672f61706f7261742f73746f72652d726563656970742d76616c696461746f722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/aporat/store-receipt-validator)[![Code Coverage](https://camo.githubusercontent.com/b981bee02926f2b7b3339f8048c28688990f1bf86d4187600933329f642779d0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f61706f7261742f73746f72652d726563656970742d76616c696461746f722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/aporat/store-receipt-validator/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0f65fe05cab0084fe443b0ba83723f21bea87f078a8fe77b0001d6155f46257c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f61706f7261742f73746f72652d726563656970742d76616c696461746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/aporat/store-receipt-validator/?branch=master)[![License](https://camo.githubusercontent.com/320bdfb2cb0208097eab3e69aa18ce2c08d6c1e092646242727d75d1b0388800/68747470733a2f2f706f7365722e707567782e6f72672f61706f7261742f73746f72652d726563656970742d76616c696461746f722f6c6963656e73652e737667)](https://packagist.org/packages/aporat/store-receipt-validator)

PHP library that can be used to validate base64 encoded iTunes in app purchase receipts.

Requirements
------------

[](#requirements)

- PHP &gt;= 5.5

Getting Started
---------------

[](#getting-started)

The easiest way to work with this package is when it's installed as a Composer package inside your project. Composer isn't strictly required, but makes life a lot easier.

If you're not familiar with Composer, please see .

1. Add iap-validator to your application's composer.json.

    ```
     {
         ...
         "require": {
             "aporat/store-receipt-validator": "dev-master"
         },
         ...
     }

    ```
2. Run `php composer install`.
3. If you haven't already, add the Composer autoload to your project's initialization file. (example)

    ```
     require 'vendor/autoload.php';

    ```

Quick Example
-------------

[](#quick-example)

### iTunes

[](#itunes)

```
use ReceiptValidator\iTunes\Validator as iTunesValidator;

$validator = new iTunesValidator(iTunesValidator::ENDPOINT_PRODUCTION);

$receiptBase64Data = 'ewoJInNpZ25hdHVyZSIgPSAiQXBNVUJDODZBbHpOaWtWNVl0clpBTWlKUWJLOEVkZVhrNjNrV0JBWHpsQzhkWEd1anE0N1puSVlLb0ZFMW9OL0ZTOGNYbEZmcD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U9EWTRJanNLQ1NKd2NtOWtkV04wTFdsa0lpQTlJQ0pqYjIwdWJXbHVaRzF2WW1Gd2NDNWtiM2R1Ykc5aFpDSTdDZ2tpYVhSbGJTMXBaQ0lnUFNBaU5USXhNVEk1T0RFeUlqc0tDU0ppYVdRaUlEMGdJbU52YlM1dGFXNWtiVzlpWVhCd0xrMXBibVJOYjJJaU93b0pJbkIxY21Ob1lYTmxMV1JoZEdVdGJYTWlJRDBnSWpFek16VTNPVGd6TlRVNE5qZ2lPd29KSW5CMWNtTm9ZWE5sTFdSaGRHVWlJRDBnSWpJd01USXRNRFF0TXpBZ01UVTZNRFU2TlRVZ1JYUmpMMGROVkNJN0Nna2ljSFZ5WTJoaGMyVXRaR0YwWlMxd2MzUWlJRDBnSWpJd01USXRNRFF0TXpBZ01EZzZNRFU2TlRVZ1FXMWxjbWxqWVM5TWIzTmZRVzVuWld4bGN5STdDZ2tpYjNKcFoybHVZV3d0Y0hWeVkyaGhjMlV0WkdGMFpTSWdQU0FpTWpBeE1pMHdOQzB6TUNBeE5Ub3dOVG8xTlNCRmRHTXZSMDFVSWpzS2ZRPT0iOwoJImVudmlyb25tZW50IiA9ICJTYW5kYm94IjsKCSJwb2QiID0gIjEwMCI7Cgkic2lnbmluZy1zdGF0dXMiID0gIjAiOwp9';

try {
  $response = $validator->setReceiptData($receiptBase64Data)->validate();
} catch (Exception $e) {
  echo 'got error = ' . $e->getMessage() . PHP_EOL;
}

if ($response->isValid()) {
  echo 'Receipt is valid.' . PHP_EOL;
  echo 'Receipt data = ' . print_r($response->getReceipt()) . PHP_EOL;
} else {
  echo 'Receipt is not valid.' . PHP_EOL;
  echo 'Receipt result code = ' . $response->getResultCode() . PHP_EOL;
}
```

### Play Store

[](#play-store)

Get the refresh token from [OAuth2 flow](https://developers.google.com/android-publisher/authorization).

```
use ReceiptValidator\GooglePlay\Validator as PlayValidator;
$validator = new PlayValidator([
    'client_id' => '...',
    'client_secret' => '...',
    'refresh_token' => '...'
]);

try {
  $response = $validator->setPackageName('PACKAGE_NAME')
    ->setProductId('PRODUCT_ID')
    ->setPurchaseToken('PURCHASE_TOKEN')
    ->validate();
} catch (Exception $e){
  var_dump($e->getMessage());
  // example message: Error calling GET ....: (404) Product not found for this application.
}
// success
```

Or [Using a service account](https://developers.google.com/android-publisher/getting_started#using_a_service_account)

Create service account [Service Account flow](https://developers.google.com/identity/protocols/OAuth2ServiceAccount)

```
use ReceiptValidator\GooglePlay\ServiceAccountValidator as PlayValidator;
$validator = new PlayValidator([
    'client_email' => 'xxxxxx@developer.gserviceaccount.com',
    'p12_key_path' => 'MyProject.p12',
]);

try {
  $response = $validator->setPackageName('PACKAGE_NAME')
    ->setProductId('PRODUCT_ID')
    ->setPurchaseToken('PURCHASE_TOKEN')
    ->validate();
} catch (Exception $e){
  var_dump($e->getMessage());
  // example message: Error calling GET ....: (404) Product not found for this application.
}
// success
```

### Amazon App Store

[](#amazon-app-store)

```
use ReceiptValidator\GooglePlay\Validator as AmazonValidator;

$validator = new AmazonValidator();
try {
  $receiptResponse = $validator->setDeveloperSecret('DEVELOPER_SECRET')
    ->setReceiptId('ORDER_ID')
    ->setUserId('AMAZON_USER_ID')
    ->validate();
  } catch (\Exception $e) {
    var_dump($e->getMessage());
  }

  if ($receiptResponse->isValid()) {
    $product_id = $receiptResponse->getReceipt()['productId'];
  } else {
    // Not valid receipt
  }
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 59% 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 ~125 days

Recently: every ~237 days

Total

24

Last Release

1409d ago

PHP version history (3 changes)1.0.0PHP &gt;=5.4

1.1.1PHP &gt;=5.3

1.3.0PHP &gt;=5.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/52275?v=4)[Zaboday](/maintainers/zaboday)[@Zaboday](https://github.com/Zaboday)

---

Top Contributors

[![aporat](https://avatars.githubusercontent.com/u/415576?v=4)](https://github.com/aporat "aporat (36 commits)")[![AlexeyKupershtokh](https://avatars.githubusercontent.com/u/499778?v=4)](https://github.com/AlexeyKupershtokh "AlexeyKupershtokh (8 commits)")[![Zaboday](https://avatars.githubusercontent.com/u/52275?v=4)](https://github.com/Zaboday "Zaboday (6 commits)")[![grEvenX](https://avatars.githubusercontent.com/u/26375?v=4)](https://github.com/grEvenX "grEvenX (3 commits)")[![ferjul17](https://avatars.githubusercontent.com/u/1574473?v=4)](https://github.com/ferjul17 "ferjul17 (2 commits)")[![whs](https://avatars.githubusercontent.com/u/345483?v=4)](https://github.com/whs "whs (2 commits)")[![danilphd](https://avatars.githubusercontent.com/u/4017428?v=4)](https://github.com/danilphd "danilphd (2 commits)")[![lstrojny](https://avatars.githubusercontent.com/u/79707?v=4)](https://github.com/lstrojny "lstrojny (1 commits)")[![stokic](https://avatars.githubusercontent.com/u/2147162?v=4)](https://github.com/stokic "stokic (1 commits)")

---

Tags

itunespurchaseapplein appreceipt

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zaboday-store-receipt-validator/health.svg)

```
[![Health](https://phpackages.com/badges/zaboday-store-receipt-validator/health.svg)](https://phpackages.com/packages/zaboday-store-receipt-validator)
```

###  Alternatives

[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[readdle/app-store-receipt-verification

Pure PHP App Store receipt parsing/validation/verification without API calls to App Store API.

25201.4k](/packages/readdle-app-store-receipt-verification)[readdle/app-store-server-api

Pure-PHP library that allows managing customer transactions using the App Store Server API and handling server-to-server notifications using the App Store Server Notifications V2

74373.5k1](/packages/readdle-app-store-server-api)[yanlongli/app-store-server-api

PHP client for App Store Server API. Manage your customers’ App Store transactions from your server.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.App Store Server API is independent of the app’s installation status on the customer’s devices. The App Store server returns information based on the customer’s in-app purchase history regardless of whether the customer installed, removed, or reinstalled the app on their devices.To request transaction and subscription status information with this API, provide any original transaction identifier that belongs to the customer. The transaction history API responds with a complete list of transactions, 20 at a time, starting with the oldest first. The subscription status API returns the status for all of the customer’s subscriptions, organized by their subscription group identifier.Use the Send Consumption Information endpoint to send information to the App Store when customers request a refund for a consumable in-app purchase, after you receive the CONSUMPTION\_REQUEST App Store server notification. Your data helps inform refund decisions.

2532.0k](/packages/yanlongli-app-store-server-api)[robertogallea/laravel-codicefiscale

Codice fiscale validation for php/laravel

58151.6k1](/packages/robertogallea-laravel-codicefiscale)[alxmsl/appstoreclient

AppStore client for iTunes purchases receipts verification

2926.2k](/packages/alxmsl-appstoreclient)

PHPackages © 2026

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