PHPackages                             raazpuspa/iap-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. raazpuspa/iap-validator

ActivePackage

raazpuspa/iap-validator
=======================

Composer package to validate in-app purchase receipts made to iTunes or Google through mobile apps.

v1.0(8y ago)035MITPHPPHP &gt;=5.6 || ^7.0

Since Nov 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/RaazPuspa/iap-validator)[ Packagist](https://packagist.org/packages/raazpuspa/iap-validator)[ RSS](/packages/raazpuspa-iap-validator/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

in-app purchase validator
=========================

[](#in-app-purchase-validator)

**iap-validator** is a php composer package to validate in-app purchase receipts received from iTunes App Store. Also, this package provides easy access to all the information and details of purchase identified by provided receipt key.

**iap-validator** uses [Guzzle Http Client](https://github.com/guzzle/guzzle)in background to make Http request to the iTunes App Store server.

Requirement
-----------

[](#requirement)

- PHP &gt;= 5.6
- Guzzle Http Client &gt;= 6.3

*Package will automatically install **Guzzle Http Client** for your convenience*

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

[](#installation)

We recommend you to install **iap-validator** through Composer. Move to  for detail instructions on installing and using composer or run the following command on your terminal.

```
curl -sS https://getcomposer.org/installer | php
```

Run Composer command to install **iap-validator**

```
composer require raazpuspa/iap-validator
```

If you have not linked your composer installer to your bin path, checkout to your directory consisting *composer.phar* and run composer with php.

```
php composer.phar require raazpuspa/iap-validator
```

For smooth running, you need to require Composer's autoloder:

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

To pull latest update of **iap-validator** use composer update:

```
composer update
```

OR

```
composer.phar update
```

Usage
-----

[](#usage)

Its too easy to use **iap-validator**. You just need to place single `use`statement on your related file to include the package.

```
use RaazPuspa\IAPValidator\iTunes\IAPValidator;
```

Next, initialize an object of `IAPValidator` class to access any provided methods.

```
$iapValidator = new IAPValidator();
```

We extract your application's secured secret key used to make Http requests to iTunes App Store from your `.env` file. Set `IAP_ITUNES_SECRET=` in your `.env` file.

Two constant values are provided for easy selection of server endpoint.

```
const PRODUCTION_ENDPOINT = 'https://buy.itunes.apple.com/verifyReceipt';
const SANDBOX_ENDPOINT = 'https://sandbox.itunes.apple.com/verifyReceipt';
```

#### Example

[](#example)

```
# import validator class
use RaazPuspa\IAPValidator\iTunes\IAPValidator;

# initialize new validator class instance
$iapValidator = new IAPValidator();

# Set server end-point for instance of IAPValidator class.
# Choose one from the two provided end-point constants. Select production
# end-point for live app while sandbox end-point during testing
$iapValidator->setEndPoint($iapValidator::PRODUCTION_ENDPOINT);

# Validates provided data and returns validation receipt.
# @param $receiptData string base64 encoded purchase receipt from App Store
# @param $endPoint string server end-point (optional, but is required if you
# had not set it earlier)
$response = $iapValidator->validateReceipt($receipt, $endPoint);

# get validation status code
$statusCode = $response->getStatusCode();

# If validated successfully, status code will be 0 (zero). On other scenario,
# status codes represent as mentioned in official iTunes documentation.
```

[iTunes Developer Documentation, list of status codes](https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW5)

```
# if validation is successful, you can get receipt information with following
# method calls
# get the status of validation
$statusCode = $response->getStatusCode();

# get current app environment upon which validation is performed
$environment = $response->getEnvironment();

# get just the receipt object
$receipt = $response->getReceipt();

# get in-app product information
$inApp = $response->getInApp();

# get latest receipt information
$latestReceiptInfo = $response->getLatestReceiptInfo();

# get latest base64 encoded receipt string
$latestReceipt = $response->getLatestReceipt();

# get pending renewal information if product is renewable/subscription based
$pendingRenewalInfo = $response->getPendingRenewalInfo();
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3089d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e18a57555c4a57d87ed25465beccd55eda371c5ed25301ad008cb97c90bcac63?d=identicon)[raazpuspa](/maintainers/raazpuspa)

---

Top Contributors

[![RaazPuspa](https://avatars.githubusercontent.com/u/10107534?v=4)](https://github.com/RaazPuspa "RaazPuspa (4 commits)")

---

Tags

composerin-app-purchaseituneslaravelphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/raazpuspa-iap-validator/health.svg)

```
[![Health](https://phpackages.com/badges/raazpuspa-iap-validator/health.svg)](https://phpackages.com/packages/raazpuspa-iap-validator)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k20](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)

PHPackages © 2026

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