Created
February 3, 2016 20:29
-
-
Save greyhoundforty/241b7b81e90532631b7e to your computer and use it in GitHub Desktop.
Get the product ID from a billing ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I am trying to get the Product ID from the billing item ID and something here is not working. | |
``` | |
ryan@galileo ~/php % php getbillingid.php | |
stdClass Object | |
( | |
[allowCancellationFlag] => 1 | |
[cancellationDate] => | |
[categoryCode] => guest_core | |
[createDate] => 2016-02-03T14:18:41-06:00 | |
[currentHourlyCharge] => .023 | |
[cycleStartDate] => 2016-02-03T14:24:28-06:00 | |
[description] => 1 x 2.0 GHz Core | |
[domainName] => tinybot.io | |
[hostName] => test | |
[hourlyRecurringFee] => .023 | |
[hoursUsed] => 1 | |
[id] => 83167765 | |
[laborFee] => 0 | |
[laborFeeTaxRate] => 0 | |
[lastBillDate] => 2016-02-03T14:24:28-06:00 | |
[modifyDate] => 2016-02-03T14:24:28-06:00 | |
[nextBillDate] => 2016-02-24T00:00:00-06:00 | |
[oneTimeFee] => 0 | |
[oneTimeFeeTaxRate] => 0 | |
[orderItemId] => 107133455 | |
[parentId] => | |
[recurringFee] => .023 | |
[recurringFeeTaxRate] => 0 | |
[recurringMonths] => 1 | |
[serviceProviderId] => 1 | |
[setupFee] => 0 | |
[setupFeeTaxRate] => 0 | |
[resourceTableId] => 15694805 | |
) | |
``` | |
I plug the billing ID I get from the previous call in to the following code and it does not return anything | |
``` | |
<?php | |
require_once './vendor/autoload.php'; | |
$apiUsername = 'xx'; | |
$apiKey = 'xxx'; | |
$itemId = '83167765'; # Billing ID of the service or item you want to cancel | |
$billingItemService = 'SoftLayer_Billing_Item'; | |
try { | |
$billingItemClient = \SoftLayer\SoapClient::getClient($billingItemService, $itemId, $apiUsername, $apiKey); | |
$result = $billingItemClient->getAssociatedParent(); | |
print_r($result); | |
} catch(Exception $e) { | |
echo 'Unable to get Associated Parent ID: ' . $e->getMessage(); | |
} | |
?> | |
ryan@galileo ~/php % php productfrombilling.php | |
ryan@galileo ~/php % | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment