PHP code example of leehom1988 / ios-iap-verification-php

1. Go to this page and download the library: Download leehom1988/ios-iap-verification-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leehom1988 / ios-iap-verification-php example snippets



LeeHom\AppleInAppPurchaseVerification;

// The receipt-data from apple
$receiptData = 'MIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
// The password your own, if your IAP is not a subscription, let it empty string(like this:''), else use your own password
$password = 'baXXXXXXXXXXXXXXXXXXXXXXXXX';

$appleIAP = new AppleInAppPurchaseVerification($receiptData, $password, true);
$result = $appleIAP->validateReceipt();
echo $result;


LeeHom\AppleInAppPurchaseVerification;

// apple返回的支付参数 receipt-data
$receiptData = 'MIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
// 如果产品类型为订阅型的,请使用校验需要的密码;如果不是订阅型的产品,请将其置为空字符串
$password = 'baXXXXXXXXXXXXXXXXXXXXXXXXX';

$appleIAP = new AppleInAppPurchaseVerification($receiptData, $password, true);
$result = $appleIAP->validateReceipt();
echo $result;
bash
$ composer 
bash
$ php Demo.php start