put https://secure.fusebill.com/v1/BillingPeriodDefinitions
Update the information on an existing billing period definition. Ideally, this is a modified version of a read details result.
Request Parameters
Parameter | Type | Description |
---|---|---|
invoiceDay | Integer | Modified day of the month to bill on |
invoiceMonth | Integer | Modified month of the year to bill on |
invoiceInAdvance | Number | The number of days in advance this billing period definition will invoice. Relevant only for accounts which use the invoice in advance feature. |
paymentMethodId | Number | A billing period definition can have a specific payment method associated with it. If so, then this is the Fusebill generated ID of the payment method. This is an override, so NULL means to use the customer default method. This is relevant only for automatic collection. |
autoCollect | Boolean | A billing period definition can override whether its resulting invoices are eligible for automatic collection attempts. Since this is an override, NULL means to use the customer's default setting. |
autoPost | Boolean | A billing period definition can override whether its generated invoices should be posted, or remain in ready draft. Since this is an override, NULL means to use the customer's default setting. |
term | Enum:{Net0, Net5, Net7, Net10, Net15, Net21, Net30, Net45, Net60, Net75, Net90, MFI1, DayOfMonth1, DayOfMonth2, DayOfMonth3, ... DayOfMonth29, DayOfMonth30, DayOfMonth31} | A billing period definition can override what the billing term will be on its resulting invoices. Since this is an override, NULL or the empty string means to use the customer's default setting. |
poNumber | String [Max Length: 255 characters] | A billing period definition can override what the PO number will be on its resulting invoices. Since this is an override, NULL or the empty string means to use the customer's default setting. |
id | Integer | Unique identifier of the billing period to modify |
Examples
curl –X PUT https://secure.fusebill.com/v1/BillingPeriodDefinitions/{billingPeriodID} \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{invoiceDay:2,id:1234}"
//Json data
string jsonData = "{'invoiceDay':2,'id':1234}" ;
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/BillingPeriodDefinitions/{billingPeriodID}");
//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();
}
#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 dict to the Payload parameter
payload = {'invoiceDay':2,'id':1234}
#Pass in your URI, Payload and Headers
r = requests.put('https://secure.fusebill.com/v1/BillingPeriodDefinitions/{billingPeriodID}', data=json.dumps(payload), headers=headers)
print(r.content)
{
"currentBillingPeriodStartDate": "2019-10-29T04:00:00",
"currentBillingPeriodEndDate": "2020-01-22T05:00:00",
"nextRechargeDate": "2020-01-22T05:00:00",
"invoiceDay": 24,
"invoiceMonth": null,
"cycle": "Monthly",
"billingPeriodType": "SpecifiedDate",
"createdDate": "2019-10-29T04:02:33",
"numberOfIntervals": 3,
"numberOfBillingPeriods": 3,
"invoiceInAdvance": 0,
"manuallyCreated": false,
"paymentMethodId": null,
"autoCollect": null,
"autoPost": true,
"term": "",
"subscriptions": {
"headers": {
"count": 1,
"currentPage": 0,
"previousPage": -1,
"nextPage": 1,
"maxCount": 1,
"pageSize": 10000,
"maxPageIndex": 1,
"sortExpression": "planCode",
"sortOrder": "Ascending",
"additionalData": null
},
"results": [
{
"customerId": 593500,
"planId": 17126,
"planCode": "bronze",
"name": "Bronze",
"description": null,
"reference": null,
"interval": "Monthly",
"numberOfInterval": 3,
"subscriptionStatus": "Draft",
"monthlyRecurringRevenue": 0.0000,
"netMonthlyRecurringRevenue": 0.0000,
"lastBillingDate": null,
"nextBillingDate": null,
"expiryDate": null,
"scheduledActivationTimestamp": null,
"cancellationTimestamp": null,
"suspendedTimestamp": null,
"createdTimestamp": "2019-08-02T15:32:30",
"modifiedTimestamp": "2019-08-02T15:32:31.133",
"activatedTimestamp": null,
"provisionedTimestamp": null,
"nextPeriodStartDate": "2020-01-22T05:00:00",
"contractStartTimestamp": null,
"contractEndTimestamp": null,
"remainingInterval": 4,
"migrationDate": null,
"scheduledMigrationDate": null,
"canMigrate": false,
"id": 301069,
"uri": "https://secure.fusebill.com/v1/BillingPeriodDefinitions/301069/"
}
]
},
"id": 227787,
"uri": "https://secure.fusebill.com/v1/BillingPeriodDefinitions/227787"
}
Response
{
"currentBillingPeriodStartDate": "2019-10-29T04:00:00",
"currentBillingPeriodEndDate": "2020-01-22T05:00:00",
"nextRechargeDate": "2020-01-22T05:00:00",
"invoiceDay": 24,
"invoiceMonth": null,
"cycle": "Monthly",
"billingPeriodType": "SpecifiedDate",
"createdDate": "2019-10-29T04:02:33",
"numberOfIntervals": 3,
"numberOfBillingPeriods": 3,
"invoiceInAdvance": 0,
"manuallyCreated": false,
"paymentMethodId": null,
"autoCollect": null,
"autoPost": true,
"term": "",
"poNumber":null,
"subscriptions": {
"headers": {
"count": 1,
"currentPage": 0,
"previousPage": -1,
"nextPage": 1,
"maxCount": 1,
"pageSize": 10000,
"maxPageIndex": 1,
"sortExpression": "planCode",
"sortOrder": "Ascending",
"additionalData": null
},
"results": [
{
"customerId": 593500,
"planId": 17126,
"planCode": "bronze",
"name": "Bronze",
"description": null,
"reference": null,
"interval": "Monthly",
"numberOfInterval": 3,
"subscriptionStatus": "Draft",
"monthlyRecurringRevenue": 0.0000,
"netMonthlyRecurringRevenue": 0.0000,
"lastBillingDate": null,
"nextBillingDate": null,
"expiryDate": null,
"scheduledActivationTimestamp": null,
"cancellationTimestamp": null,
"suspendedTimestamp": null,
"createdTimestamp": "2019-08-02T15:32:30",
"modifiedTimestamp": "2019-08-02T15:32:31.133",
"activatedTimestamp": null,
"provisionedTimestamp": null,
"nextPeriodStartDate": "2020-01-22T05:00:00",
"contractStartTimestamp": null,
"contractEndTimestamp": null,
"remainingInterval": 4,
"migrationDate": null,
"scheduledMigrationDate": null,
"canMigrate": false,
"id": 301069,
"uri": "https://secure.fusebill.com/v1/BillingPeriodDefinitions/301069/"
}
]
},
"id": 227787,
"uri": "https://secure.fusebill.com/v1/BillingPeriodDefinitions/227787"
}
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "BillingPeriodDefinition with id 1 not found."
}
]
}