$accountData->externalKey = uniqid(); $account = $accountData->create("web-user", "PHP_TEST", "Test for the demo", $tenantHeaders); if ($account != null && $account->accountId != null) { $_SESSION['accountId'] = $account->accountId; $account_created = TRUE; } else { $account = new Killbill_Account(); $account_created = FALSE; } } else { // Update the account $accountData->accountId = $_SESSION['accountId']; // TODO API needs to be fixed $currentAccount = $accountData->get($tenantHeaders); $accountData->externalKey = $currentAccount->externalKey; $account = $accountData->update("web-user", "PHP_TEST", "Test for the demo", $tenantHeaders); if ($account != null) { $account_updated = TRUE; } else { $account = new Killbill_Account(); $account_updated = FALSE; } } } else { $account = new Killbill_Account(); if (isset($_SESSION['accountId'])) { $account->accountId = $_SESSION['accountId']; $account = $account->get($tenantHeaders); } } include_once dirname(__FILE__) . '/includes/header.php';