post https://secure.fusebill.com/v1/DraftPaymentSchedules
This call allows you to modify a draft invoice to allow a one time payment schedule on this particular invoice. If you wish for this payment schedule to occur on future invoices you must re-run this api call.
Request Parameters
The request body should be a list of objects, each of which has these three fields. The sum of the amount
values must equal the total amount for the draft invoice
Property | Type | Description | Required |
---|---|---|---|
invoiceId | Integer | This is the ID of the draft invoice you wish to create payment schedules for | Yes |
amount | Decimal | This is the dollar value of the specific payment | Yes |
daysDueAfterTerm | Integer | This is the day that the above charge will take place from the date of posting the invoice. | Yes |
Examples
curl -X POST "https://secure.fusebill.com/v1/DraftPaymentSchedules/" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "[{invoiceId:{invoiceId},amount:9.99,daysDueAfterTerm:5}]"
//Json Payload
string jsonData =
"[{invoiceId:{invoiceId},amount:10.00,daysDueAfterTerm:5}]";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/DraftPaymentSchedules/");
//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 = [{"InvoiceId":{id},"amount":20.00, "daysDueAfterTerm": 5}]
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/DraftPaymentSchedules', data=json.dumps(payload), headers=headers)
print(r.content)
[
{
"invoiceId": 1184230,
"amount": 100,
"daysDueAfterTerm": 3
},
{
"invoiceId": 1184230,
"amount": 224,
"daysDueAfterTerm": 4
}
]
Response
Upon success this call returns a 204 No Content
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "The sum of the amounts for the draft payment schedules must match the total value of the draft invoice."
}
]
}