Exemplo n.º 1
0
$password = '';
$receipt = '';
$Command = new CommandPosix();
$Command->appendHelpParameter('show help');
$Command->appendParameter(new Option('password', 'p', 'subscription password', Option::TYPE_STRING), function ($name, $value) use(&$password) {
    $password = $value;
});
$Command->appendParameter(new Option('receipt', 'r', 'receipt data (base 64)', Option::TYPE_STRING, true), function ($name, $value) use(&$receipt) {
    $receipt = $value;
});
$Command->appendParameter(new Option('test', 't', 'use sandbox', Option::TYPE_BOOLEAN), function ($name, $value) use(&$isSandbox) {
    $isSandbox = $value;
});
try {
    $Command->parse(true);
    $AppStore = new Client();
    $AppStore->setSandbox($isSandbox);
    if (!empty($password)) {
        $AppStore->setPassword($password);
    }
    $Response = $AppStore->verifyReceipt($receipt);
    switch (true) {
        case $Response instanceof Status:
            printf("---\nfound iOS6 receipt\n");
            break;
        case $Response instanceof RenewableStatus:
            printf("---\nfound iOS6 renewable receipt\n");
            break;
        case $Response instanceof ResponsePayload:
            printf("---\nfound iOS7 receipt\n");
            break;
Exemplo n.º 2
0
<?php

/**
 * This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The F**k You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://www.wtfpl.net/ for more details.
 *
 * App Store In-App purchase receipt verification
 * @author alxmsl
 * @date 2/16/13
 */
include '../source/Autoloader.php';
include '../vendor/alxmsl/network/source/Autoloader.php';
use alxmsl\AppStore\Client;
use alxmsl\AppStore\Exception\ExpiredSubscriptionException;
/**
 * Define needed constants
 */
const PASSWORD = '******', SANDBOX = true, RECEIPT = 'MySECReT5u8sCR1Pti0NRece1Pt=';
// Create App Store client for production or sandbox
$AppStore = new Client();
$AppStore->setPassword(PASSWORD)->setSandbox(SANDBOX);
// Verify subscription receipt
try {
    var_dump($AppStore->verifyReceipt(RECEIPT));
} catch (ExpiredSubscriptionException $ex) {
    var_dump($ex->getStatus());
}
Exemplo n.º 3
0
<?php

/**
 * This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The F**k You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://www.wtfpl.net/ for more details.
 *
 * App Store In-App purchase receipt verification
 * @author alxmsl
 * @date 2/16/13
 */
include '../source/Autoloader.php';
include '../vendor/alxmsl/network/source/Autoloader.php';
use alxmsl\AppStore\Client;
/**
 * Define needed constants
 */
const SANDBOX = true, RECEIPT = 'MySECReTRece1Pt=';
// Create App Store client for production or sandbox
$AppStore = new Client();
$AppStore->setSandbox(SANDBOX);
// Verify purchase receipt
var_dump($AppStore->verifyReceipt(RECEIPT));