Bulk Invoice Payment Procedure

The bulk payment procedure leverages the bulk job API to apply payments to invoices in bulk based on the customer ID.

Prerequisites

You must have bulk jobs activated before the bulk invoice payment can be initiated. Contact Stax Bill support for information related to activating bulk jobs.

Create a Bulk Payment Job

To initiate a bulk payment job, complete the following call:

Post https://secure.fusebill.com/v1/bulkPaymentSubmit {
     "accountUploadType": "bulkPayment",
     "data": [{customerId1},{customerId2},{customerId3},{customerId4},{...}]
}

Where customerId1 is the customer ID to which the payment will be applied. Along with the customer, additional data including the invoice ID can be supplied.
The following is a sample JSON return:

"accountId": 1088623,
    "type": "BulkPayment",
    "status": "Validated",
    "createdTimestamp": "2021-01-18T19:15:40.0004998Z",
    "completedTimestamp": "2021-01-18T19:15:40.6692143Z",
    "totalRecords": 1,
    "successfulRecords": 1,
    "failedRecords": 0,
    "totalProcessedRecords": null,
    "processedRecords": null,
    "failedProcessedRecords": null,
    "importingTimestamp": null,
    "processedTimestamp": null,
    "fileName": "BulkPayment-20210118.csv",
    "reference": "Bulk Payment",
    "relatedId": null,
    "internalAutomatedFlag": false,
    "modifiedTimestamp": "0001-01-01T00:00:00",
    "id": 25227,
    "uri": null

Note: Make note of the return JSON ID value to reference the correct bulk job ID. In this example it would be 25227.

Example Bulk Payment Call

The following is a sample bulk payment call.

Post https://secure.fusebill.com/v1/bulkPaymentSubmit


{
  "customerId": 655080,
  "reference": "This is a sample check recording",
  "amount": 50.78,
  "paymentMethod": "Check",
  "autoAllocate": True,
  "autoAllocateOrder": "OldestToNewest",
  "source": "Import"
},
{
  "customerId": 655080,
  "reference": "This is a sample force cc payment",
  "amount": 50.78,
  "paymentMethod": "CreditCard",
  "paymentMethodId": 324324                               
  "autoAllocate": True,
  "autoAllocateOrder": "OldestToNewest",
  "source": "Import"
},
{
  "customerId": 655080,
  "reference": "This is a sample force cc payment",
  "amount": 50.78,
  "useDefaultPaymentMethod": True,
  "autoAllocate": True,
  "autoAllocateOrder": "OldestToNewest",
  "source": "Import"
},

{
  "customerId": 655080,
  "reference": "This is a sample specified allocation",
  "amount": 50.78,
  "paymentMethod": "Check",
  "paymentAllocations":[
       {
       "invoiceID": 323232,
       "amount": 20.38
       },
       {
       "invoiceID": 323299,
       "amount": 30.40
       }
   ],      
  "source": "Import"
}

Poll Bulk Job

Once the bulk job has been created, you can view the details of the job. To view the job, complete the following API call:

GET https://secure.fusebill.com/v1/BulkApi/{BulkJobID}?view=full

where {BulkJobID} is the bulk job ID returned from the previous step.
The returned JSON provides specific details about the job.

Process Bulk Job

To process the bulk payment, complete the following API call:

POST https://secure.fusebill.com/v1/BulkApi/Process/
{
"id":{bulkJobID}
}

Optional: Job Cancellation

If you need to cancel a bulk payment, use the following API call. Note that only payments that have not been processed will be cancelled.

Post https://secure.fusebill.com/v1//BulkApi/Cancel/{bulkJobID}