post https://secure.fusebill.com/v1/billingstatements/generate
This function is used to generate a billing statement.
Please note all time fields are in UTC Time.
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
customerId | Integer | The Customer ID of the customer that this billing statement applies against. | Yes |
startDate | Datetime | This is the start date of of the date range for the billing statements. | Yes |
endDate | Datetime | This is the end date of of the date range for the billing statements. | Yes |
trackedItemDisplay | Object. Defined below | This is a collection of statement display settings related to tracked items. | Optional |
Tracked Item Display Fields
Property | Type | Description | Required |
---|---|---|---|
trackedItemDisplayFormat | Enum:{SeparatePage, Inline} | Controls whether tracked items are displayed on a separate page or inline on the front page. | Optional |
showTrackedItemName | Boolean | This controls if the tracked items names are displayed. | Yes if the trackedItemDisplay object is being included in this POST request. |
showTrackedItemReference | Boolean | This controls if the tracked items refrenece are displayed. | Yes if the trackedItemDisplay object is being included in this POST request. |
showTrackedItemDescription | Boolean | This controls if the tracked items description are displayed. | Yes if the trackedItemDisplay object is being included in this POST request. |
showTrackedItemCreatedDate | Boolean | This field controls if the tracked items creation dates are displayed. | Yes if the trackedItemDisplay object is being included in this POST request. |
Examples
curl -X POST "https://secure.fusebill.com/v1/billingstatements/generate" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{customerId:{customerId},startDate:'2017-01-01',endDate:'2017-01-31'}"
//Json Payload
string jsonData = "{customerId:{customerId},startDate:'2017-01-01',endDate:'2017-01-31'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/billingstatements/generate");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic " + apiKey);
//Set request method
request.Method = "POST";
//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();
}
#Import library JSON
import json
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dictionary to the Payload parameter
payload = {"customerId":{id},"startDate":'2017-01-01',"endDate":'2017-02-10'}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/billingstatements/generate', data=json.dumps(payload), headers=headers)
print(r.content)
{
"customerId": 655080,
"startDate": "2019-10-27T15:17:25+00:00",
"endDate": "2019-11-26T15:17:25+00:00",
"trackedItemDisplay": {
"trackedItemDisplayFormat":"SeparatePage",
"showTrackedItemName": true,
"showTrackedItemReference": true,
"showTrackedItemDescription": true,
"showTrackedItemCreatedDate": true
}
}
Response
{
"transactions":[
{
"effectiveTimestamp":"2017-01-16T10:00:00",
"transactionType":"Credit",
"name":"Credit",
"description":"this is an example credit",
"reference":null,
"arDebit":0.0000,
"arCredit":10.0000,
"runningTotal":-10.0000,
"associatedId":null,
"productItems":null,
"id":7327986,
"uri":null
},
{
"effectiveTimestamp":"2017-01-16T21:07:38",
"transactionType":"Payment",
"name":"Credit Card (Visa ending in 1111)",
"description":"this is an example payment",
"reference":"aiu5749q",
"arDebit":0.0000,
"arCredit":10.0000,
"runningTotal":-30.0000,
"associatedId":7327933,
"productItems":null,
"id":7327933,
"uri":null
},
{
"effectiveTimestamp":"2017-01-16T21:55:59",
"transactionType":"Refund",
"name":"Credit Card (Visa ending in 1111)",
"description":"Refund of payment 7327933 this is an example payment",
"reference":"this is an example refund",
"arDebit":10.0000,
"arCredit":0.0000,
"runningTotal":-20.0000,
"associatedId":7327933,
"productItems":null,
"id":7327992,
"uri":null
},
{
"effectiveTimestamp":"2017-01-24T20:07:22",
"transactionType":"Charge",
"name":"Monthly Charge",
"description":null,
"reference":null,
"arDebit":15.9900,
"arCredit":0.0000,
"runningTotal":-4.0100,
"associatedId":7573304,
"productItems":null,
"id":7573304,
"uri":null
}
],
"header":{
"signature":"<p><strong>Kennedy Consulting</strong> \r</p>\n<p>, \r</p>\n<p><em>Kennedy Consulting | | [][1]</em></p>\n<p>[1]: </p>\n",
"customer":{
"fullName":"Mr John Doe",
"companyName":"Stolen Bikes",
"billingAddress":null
},
"customerReferenceValue":"1337"
},
"startDate":"2017-01-01T00:00:00",
"endDate":"2017-01-31T00:00:00",
"openingBalance":0.0,
"closingBalance":19.5100,
"currency":"USD",
"accountBillingStatementPreference":{
"option":"Disabled",
"type":"",
"interval":"",
"day":null,
"month":null,
"trackedItemDisplayFormat":"",
"showTrackedItemName":false,
"showTrackedItemReference":false,
"showTrackedItemDescription":false,
"showTrackedItemCreatedDate":false,
"trackedItemNameFieldOverride":null,
"trackedItemReferenceFieldOverride":null,
"trackedItemDescriptionFieldOverride":null,
"trackedItemCreatedDateFieldOverride":null,
"trackedItemPageLabelOverride":null,
"trackedItemMainInvoiceMessage":null,
"id":19,
"uri":"/19"
},
"id":0,
"uri":null
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "entity.TrackedItemDisplay.ShowTrackedItemName",
"Value": "123 is not a valid boolean value."
}
]
}