Post Ready Charges

This request posts all the charges on draft invoices associated with a specific customer that are ready to be posted. This would not post charges from draft invoices that were in status 'pending' or 'projected', since only ready draft invoices and ready draft charges can be posted.

URL Parameters

PropertyTypeDescriptionRequired
customerIdIntegerFusebill generated ID that uniquely identifies the customer whose draft invoices are to be posted if ready.Yes

Request Parameters

PropertyTypeDescriptionRequired
invoiceCollectOptionsObject. Defined belowThis can be used to provide special invoice collection instructions for the invoice which may be generated by this API callOptional

Invoice collection options

PropertyTypeDescription
paymentMethodEnum: { UseDefaultPaymentMethod, UseExistingPaymentMethod, UseExistingPaymentMethodAndMakeDefault, UseProvidedPaymentMethodOnce, UseProvidedPaymentMethodAndMakeDefault, UseProvidedPaymentMethodAndSave, CreateAndApplyCredit}Controls which payment method to use
paymentMethodIdIntegerThe Fusebill generated ID of the payment method. Provide this only if paymentMethod is "UseExistingPaymentMethod" or "UseExistingPaymentMethodAndMakeDefaul"
useAnyAvailableFundsFirstBooleanControls whether available funds on the customer entity should be used first.
creditCardObjectSee credit card creation parameters as outlined in Create Credit Card Payment Method
achCardObjectSee ACH card creation parameters as outlined in Create ACH Payment Method
rollbackOnFailedPaymentBooleanIf payment fails, Fusebill can undo this action.
Examples
curl –X POST https://secure.fusebill.com/v1/draftInvoices/PostReadyCharges?customerId={customerId}\ 
-H "Content-Type: application/json" \ 
-H "Authorization: Basic {APIKey}" \ 
-d "{}"
//Json data for payload 
string jsonData = "{}"; 
//Setup API key 
string apiKey = "{APIKey}"; 
//Configure URI 
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/draftInvoices/PostReadyCharges?customerId={customerId}"); 
//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 dict to the Payload parameter 
payload = {} 
#Pass in your URI, Payload and Headers 
r = requests.post('https://secure.fusebill.com/v1/draftInvoices/PostReadyCharges?customerId={customerId}', data=json.dumps(payload), headers=headers) 
print(r.content)
{
  "invoiceCollectOptions": {
    "paymentMethod": "UseExistingPaymentMethodAndMakeDefault",
    "paymentMethodId": 98753987,
    "useAnyAvailableFundsFirst": true,
    "creditCard": null,
    "achCard": null,
    "rollbackOnFailedPayment": false
  }
}
{
  "invoiceCollectOptions": {
    "paymentMethod": "UseProvidedPaymentMethodAndSave",
    "useAnyAvailableFundsFirst": false,
    "creditCard": {
      "cardNumber": 1234123412341234,
      "expirationMonth": 2,
      "expirationYear": 23,
      "cvv": 123,
      "firstName": "Karen",
      "lastName": "Wood",
      "address1": "10 Dodge St",
      "address2": "",
      "city": "Columbia",
      "stateId": 1,
      "countryId": 124,
      "source": "Manual",
      "postalZip": "V9V 9V9",
      "customerId": 12345678
    },
    "achCard": null,
    "rollbackOnFailedPayment": true
  }
}
{
  "invoiceCollectOptions": {
    "paymentMethod": "UseProvidedPaymentMethodOnce",
    "useAnyAvailableFundsFirst": false,
    "creditCard": null,
    "achCard": {
      "accountNumber": 123457832156,
      "transitNumber": 12345,
      "bankAccountType": "CHQ",
      "firstName": "James",
      "lastName": "McHenry",
      "address1": "98 Roberts St",
      "address2": "",
      "city": "Chicago",
      "stateId": 1,
      "countryId": 124,
      "postalZip": "V9V 9V9",
      "customerId": 12345678,
      "source": "Manual"
    },
    "rollbackOnFailedPayment": true
  }
}
Response
Upon success this call returns 204 No Content
{
    "ErrorId": 0,
    "HttpStatusCode": 404,
    "Errors": [
        {
            "Key": "Api Error",
            "Value": "Customer with id 2 not found."
        }
    ]
}
Language
Authorization