post https://secure.fusebill.com/v1/billingstatements/BySubscription/Generate
This function is used to generate a billing statement organized by subscription rather than transaction.
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/BySubscription/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/BySubscription/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/BySubscription/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":"Inline",
"showTrackedItemName": true,
"showTrackedItemReference": false,
"showTrackedItemDescription": true,
"showTrackedItemCreatedDate": true
}
}
Response
{
"lineItems": [
{
"effectiveTimestamp": "2019-11-27T15:56:52",
"invoiceNumber": 381,
"invoiceId": 566496,
"invoiceStatus": "Paid",
"name": "Steaming Subscription",
"description": null,
"reference": null,
"lineItems": [
{
"invoiceNumber": 381,
"invoiceId": 566496,
"invoiceStatus": "Paid",
"quantity": 1,
"unitPrice": 100,
"amount": 100,
"name": "Streaming Screen liscence",
"description": "A liscence for the service to be steamed to 1 screen",
"effectiveTimestamp": "2019-11-27T15:56:52",
"proratedUnitPrice": null,
"startServiceDate": "2019-11-27T00:00:00",
"endServiceDate": "2019-12-12T00:00:00",
"rangeQuantity": null,
"discounts": [
{
"configuredDiscountAmount": 1,
"amount": 1,
"quantity": 1,
"unearnedAmount": 0,
"remainingReversalAmount": 0,
"discountType": "AmountPerUnit",
"description": "$1.00 USD off Streaming Screen liscence",
"id": 0,
"uri": null
},
{
"configuredDiscountAmount": 2,
"amount": 2,
"quantity": 1,
"unearnedAmount": 0,
"remainingReversalAmount": 0,
"discountType": "Percentage",
"description": "2% off Streaming Screen liscence",
"id": 0,
"uri": null
}
],
"items": [],
"chargeTiers": []
}
],
"taxes": [],
"total": 97,
"unallocated": 0,
"allocations": null,
"nameExtension": null,
"originalActionTimestamp": null,
"child": null
}
],
"hierarchy": false,
"header": {
"signature": "<p><strong>[email protected]</strong> \r</p>\n<p><em>[email protected] | | [][1]</em></p>\n<p>[1]: </p>\n",
"customer": {
"fullName": "Vincent Smith",
"companyName": "VSmithCo",
"billingAddress": null
},
"customerReferenceValue": null
},
"startDate": "2019-11-27T15:17:25+00:00",
"endDate": "2019-12-30T15:17:25+00:00",
"openingBalance": 180,
"closingBalance": 83,
"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,
"statementActivityType": "OnlyParentActivity",
"showServiceDates": true,
"id": 12232,
"uri": "/12232"
},
"id": 0,
"uri": null
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "entity.TrackedItemDisplay.TrackedItemDisplayFormat",
"Value": "Allowable Tracked Item Display Format values are: Inline, SeparatePage"
}
]
}