Before we begin I find it helpful to set some environment variables so that we don't have to provide our SoftLayer user and API key in every call. In your terminal run the following, substituting in your Portal username and API key:
export SOFTLAYER_USERNAME=<username>
export SOFTLAYER_API_KEY=<apikey>
curl --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" -sk https://api.softlayer.com/rest/v3/SoftLayer_Account/getNextInvoiceTotalAmount.json
curl -sk "https://$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/<VSI_ID>/getBillingItem?objectMask=mask\[createDate,hoursUsed,hourlyRecurringFee,currentHourlyCharge\]"
curl --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" -sk \
https://api.softlayer.com/rest/v3/SoftLayer_Network_Storage/<ID>/getBillingItem
First get the Billing Item ID:
curl --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" -sk \
https://api.softlayer.com/rest/v3/<SERVICE>/<ID>/getBillingItem
Then invoke cancelService or cancelItem
curl --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" -sk https://api.softlayer.com/rest/v3/SoftLayer_Billing_Item/<BILLING_ID>/cancelService
If you need to associate a Billing ID with the service or item it corresponds to you can use getAssociatedBillingItem or getAssociatedParent along with an Object Mask.
curl --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" -sk "https://api.softlayer.com/rest/v3/SoftLayer_Billing_Item/1234321/getAssociatedParent?objectMask=mask\[id\]"
curl --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" -sk https://api.softlayer.com/rest/v3/SoftLayer_Billing_Item/1234321/getAssociatedBillingItem