Download the PHP package stafox/huawei-iap without Composer
On this page you can find all versions of the php package stafox/huawei-iap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stafox/huawei-iap
More information about stafox/huawei-iap
Files in stafox/huawei-iap
Package huawei-iap
Short Description Huawei In-App Purchase (IAP) verification library
License MIT
Homepage https://github.com/Stafox/huawei-iap
Informations about the package huawei-iap
Huawei IAP
PHP library that can be used for verifying In-App Purchases for the Huawei's Order and Subscription services.
Requirements
- PHP >= 7.2
- ext-json
- ext-curl
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 http://getcomposer.org/.
-
Add
huawei-iap
to your application's composer.json.{ ... "require": { "stafox/huawei-iap": "main" }, ... }
-
Run
php composer install
. -
If you haven't already, add the Composer autoload to your project's initialization file. (example)
require 'vendor/autoload.php';
Quick Usage Examples
Subscription validation
Order (one-time purchase) validation
Use custom AuthorizationStorage
By default auth token stored in-memory. To reduce number of authorization requests you can extend AuthorizationStorage to store data for longer period of time.
For example:
And then pass it into Validator.
Select store site
By default Germany store site will be used. It may be useful to use different store sites to reduce request time.
To do that you need to extend Validator
and override
createSubscriptionVerificationRequest(PurchaseData $purchaseData)
createOrderVerificationRequest(PurchaseData $purchaseData)
And extend PurchaseDate
to be able get country, for example.
Then pass needed country to Validator::getClient()
method.
All versions of huawei-iap with dependencies
ext-json Version *
ext-curl Version *
guzzlehttp/guzzle Version ~6.3|~7.0