Modifying Customer Billing Settings

To modify an existing customer’s billing settings, identify the customer you wish to edit, retrieve the customer's current billing settings from Stax Bill, apply your desired changes, and resubmit the full set of customer billing settings to the Stax Bill system.

This is achieved by doing a GET API call followed by a PUT API call against the customer billing profile object.

Use this tutorial to edit:

  • Customer Terms
  • Customer Billing Timing Settings
  • Customer Invoice Settings

Follow these steps when modifying billing settings for an existing customer via API:

Step A (Optional) - Find the Customer

If you have already stored the Stax Bill ID of the customer in your system, you do not need this step.

If you need to find the customer using your own customer code that you have stored on the customer, call:

📘

Get Customer

GET https://secure.fusebill.com/v1/customers/?query=reference:YourCode

Note that while the reference value on a customer is intended to be used for your own customer ID, Stax Bill does not enforce uniqueness on this value. The value that uniquely identifies a customer entity is the Stax Bill generated id. This call is actually returning a list of customers, filtered by their reference value. For more details on query parameters, see the string filtering section on the developer reference

Sample Request

curl -X GET "https://secure.fusebill.com/v1/customers?query=reference:YourCode" \
	-H "Content-Type: application/json" \
	-H "Authorization: Basic YourAPIKeyHere"
//query parameter
int queryParameter = "?query=reference:YourCode";
//Setup API key
string apiKey = "Your Api Key Here";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/customers/"+queryParameter);
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "GET";
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
  result = streamReader.ReadToEnd();
}

Sample Response

[
  { 
     "firstName":"John",
     "middleName":null,
     "lastName":"Smith",
     "companyName":"Acme Inc.",
     "suffix":null,
     "primaryEmail":null,
     "primaryPhone":null,
     "secondaryEmail":null,
     "secondaryPhone":null,
     "title":"Mr",
     "reference":null,
     "status":"Draft",
     "customerAccountStatus":"Good",
     "currency":"USD",
     "customerReference":{ 
        "reference1":null,
        "reference2":null,
        "reference3":null,
        "salesTrackingCodes":[ 
        ],
        "id":169456,
        "uri":"https://secure.fusebill.com/v1/customers/169456"
     },
     "customerAcquisition":{ 
        "adContent":null,
        "campaign":null,
        "keyword":null,
        "landingPage":null,
        "medium":null,
        "source":null,
        "id":169456,
        "uri":"https://secure.fusebill.com/v1/customers/169456"
     },
     "monthlyRecurringRevenue":0.0000,
     "netMonthlyRecurringRevenue":0.0000,
     "salesforceId":null,
     "salesforceAccountType":null,
     "salesforceSynchStatus":"Enabled",
     "netsuiteId":null,
     "netsuiteCustomerType":"",
     "portalUserName":null,
     "parentId":null,
     "id":169456,
     "uri":"https://secure.fusebill.com/v1/customers/169456"
  }
]

Step 1 - Get the Customer’s Billing Settings

You will need to retrieve the current billing settings of the customer. To do this call

📘

Read Customer Billing Settings

GET https://secure.fusebill.com/v1/customerbillingsetting/{{customerID}}

Sample Request

curl -X GET "https://secure.fusebill.com/v1/customerbillingsetting/1234" \
	-H "Content-Type: application/json" \
	-H "Authorization: Basic YourAPIKeyHere"
//path parameter, Fusebill Id which corresponds to the Id returned by Get Customer
int pathParameter = 1234; 
//Setup API key
string apiKey = "Your Api Key Here";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/customerbillingsetting/"+pathParameter);
//Add Content type
request.ContentType = "application/json";
request.ContentLength = 0;
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "GET";
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
  result = streamReader.ReadToEnd();
}

Sample Response

{
    "invoiceDay": null,
    "term": "Net0",
    "interval": "Monthly",
    "autoCollect": null,
    "rechargeType": "",
    "rechargeThresholdAmount": null,
    "rechargeTargetAmount": null,
    "statusOnThreshold": null,
    "autoPostDraftInvoice": null,
    "hasPaymentMethod": false,
    "customerGracePeriod": null,
    "gracePeriodExtension": null,
    "standingPoNumber": null,
    "billingPeriodConfigurations": [
    ],
    "acquisitionCost": 0,
    "showZeroDollarCharges": null,
    "taxExempt": false,
    "useCustomerBillingAddress": true,
    "taxExemptCode": null,
    "avalaraUsageType": null,
    "vatIdentificationNumber": null,
    "customerServiceStartOption": "",
    "rollUpTaxes": null,
    "rollUpDiscounts": null,
    "trackedItemDisplay": null,
    "customerBillingStatementSetting": {
        "option": null,
        "type": null,
        "interval": null,
        "day": null,
        "month": null,
        "trackedItemDisplay": null
    },
    "id": 84770,
    "uri": null
}

Step 2 - Update the Customer Billing Settings

Modify the desired field in the customer billing setting JSON object and then do a full PUT call:

📘

PUT https://secure.fusebill.com/v1/customerbillingsetting

Sample Request

curl -X PUT "https://secure.fusebill.com/v1/customerbillingsetting" \
	-H "Content-Type: application/json" \
	-H "Authorization: Basic YourAPIKeyHere" \
	-d "{id:YourCustomerIdHere,invoiceDay:null,term:'Net0',interval:'Monthly',autoCollect:null,rechargeType:'',rechargeThresholdAmount:null,rechargeTargetAmount:null,statusOnThreshold:null,autoPostDraftInvoice:null,hasPaymentMethod:false,customerGracePeriod:null,gracePeriodExtension:null,standingPoNumber:null,billingPeriodConfigurations:[],acquisitionCost:0,showZeroDollarCharges:null,taxExempt:false,useCustomerBillingAddress:true,taxExemptCode:null,avalaraUsageType:null,vatIdentificationNumber:null,customerServiceStartOption:'',rollUpTaxes:null,rollUpDiscounts:null,trackedItemDisplay:null,customerBillingStatementSetting:{option:null,type:null,interval:null,day:null,month:null,trackedItemDisplay:null}}"
//Json data, Fusebill Id which corresponds to the customerId Field
string jsonData ="{id:CustomerIdHere,invoiceDay:null,term:'Net0',interval:'Monthly',autoCollect:null,rechargeType:'',rechargeThresholdAmount:null,rechargeTargetAmount:null,statusOnThreshold:null,autoPostDraftInvoice:null,hasPaymentMethod:false,customerGracePeriod:null,gracePeriodExtension:null,standingPoNumber:null,billingPeriodConfigurations:[],acquisitionCost:0,showZeroDollarCharges:null,taxExempt:false,useCustomerBillingAddress:true,taxExemptCode:null,avalaraUsageType:null,vatIdentificationNumber:null,customerServiceStartOption:'',rollUpTaxes:null,rollUpDiscounts:null,trackedItemDisplay:null,customerBillingStatementSetting:{option:null,type:null,interval:null,day:null,month:null,trackedItemDisplay:null}}";
//Setup API key
string apiKey = "Your Api Key Here";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://stg-secure.fusebill.com/v1/customerbillingsetting");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "PUT";
//Add the json data to request
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
  streamWriter.Write(jsonData);
  streamWriter.Flush();
  streamWriter.Close();
}
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
  result = streamReader.ReadToEnd();
}

Sample Response

{
    "invoiceDay": null,
    "term": "Net0",
    "interval": "Monthly",
    "autoCollect": null,
    "rechargeType": "",
    "rechargeThresholdAmount": null,
    "rechargeTargetAmount": null,
    "statusOnThreshold": null,
    "autoPostDraftInvoice": null,
    "hasPaymentMethod": false,
    "customerGracePeriod": null,
    "gracePeriodExtension": null,
    "standingPoNumber": null,
    "billingPeriodConfigurations": [
    ],
    "acquisitionCost": 0,
    "showZeroDollarCharges": null,
    "taxExempt": false,
    "useCustomerBillingAddress": true,
    "taxExemptCode": null,
    "avalaraUsageType": null,
    "vatIdentificationNumber": null,
    "customerServiceStartOption": "",
    "rollUpTaxes": null,
    "rollUpDiscounts": null,
    "trackedItemDisplay": null,
    "customerBillingStatementSetting": {
        "option": null,
        "type": null,
        "interval": null,
        "day": null,
        "month": null,
        "trackedItemDisplay": null
    },
    "id": 84770,
    "uri": null
}