예제 #1
0
$subscription->setCustomerId($_POST['customerDomain']);
$subscription->setSubscriptionId('123');
$subscription->setSkuId(ResellerSKU::GoogleApps);
$subscription->setPurchaseOrderId("mypurchaseorder-123");
// Subscriptions have a plan.
// Note: It is not possible to transfer a premier customer to a trial.
$plan = new Google_SubscriptionPlan();
$plan->setPlanName(ResellerPlanName::FLEXIBLE);
$plan->setIsCommitmentPlan(FALSE);
// Only annual subscription plans have a commitment interval.
// The following lines are commented out for reference.
/*
    $interval = new Google_SubscriptionPlanCommitmentInterval();
    $interval->setStartTime(time());
    $interval->setEndTime(time() + (86400 * 365));
    $plan->setCommitmentInterval($interval);
*/
$subscription->setPlan($plan);
// Subscriptions have an renewal setting.
$renewal = new Google_RenewalSettings();
$renewal->setRenewalType(ResellerRenewalType::AUTO_RENEW);
$subscription->setRenewalSettings($renewal);
// Each subscription needs a seat count.
// Ideally this should pull the seat count from the previous domain.
$seats = new Google_Seats();
$seats->setMaximumNumberOfSeats($_POST['maximumNumberOfSeats']);
$seats->setNumberOfSeats($_POST['numberOfSeats']);
$subscription->setSeats($seats);
$service->subscriptions->insert($_POST['customerDomain'], $subscription, array("customerAuthToken" => $_POST['customerAuthToken']));
// Draw a simple template.
include 'templates/transfer.php';