abraovic / ios-receipt-validator
使用PHP验证iOS收据
v0.1
2016-05-09 09:17 UTC
Requires
- php: >=5.3
- lib-curl: *
- symfony/yaml: >=2.8
This package is auto-updated.
Last update: 2024-09-23 02:00:55 UTC
README
安装
推荐通过Packagist和Composer进行安装。运行以下命令安装包并将其添加到项目的composer.json
中:
composer require abraovic/ios-receipt-validator
示例
<?php require 'vendor/autoload.php'; use abraovic\iOSReceiptValidator\Validate; use abraovic\iOSReceiptValidator\Exception\iOSReceiptValidatorException; try { $receipt = 'put-your-receipt-here'; $sharedSecret = 'put-your-secret-here-if-any'; // for sandbox mode Validate::$dev = true; $validate = new Validate($receipt, $sharedSecret); $response = $validate->execute(); // returns Response object } catch (iOSReceiptValidatorException $e) { echo 'Caught exception: ' . $e->getMessage() . "\n"; }
Response对象的可用方法
$response->getStatus(); $response->getReceipt(); // returns Receipe object $response->getLatestReceipt(); $response->getLatestReceiptInfo(); // returns Receipe object
Receipt对象的可用方法
$receipt->getBundleId(); $receipt->getApplicationVersion(); $receipt->getInApp(); $receipt->getOriginalApplicationVersion(); $receipt->getCreationDate(); $receipt->getOriginalPurchaseDate();
贡献
欢迎贡献!请阅读贡献指南以获取详细信息。
版权和许可
abraovic/ios-receipt-validator库版权© Ante Braovic,并使用Apache2许可证授权使用。