Creating an Invoice and Multi-Invoice

Creating an Invoice

After you go through the Authentication process, you can call the ClientPay API in order to create invoices with a single line item or multiple.

The Invoice call requires an accessId and requestId. Use the Generate Request ID endpoint to create a requestId.

Invoice Request Object

When you POST to the Invoice endpoint, the following fields are necessary:

{
  "accessId": "sample string 1",
  "requestId": "sample string 2",
  "customerRefNumber": "sample string 3",
  "sessionId": "sample string 4",
  "invoices": [
    {
      "invoiceNumber": "sample string 1",
      "invoiceDate": "2017-12-14T11:10:21.0004016-06:00",
      "dueDate": "2017-12-14T11:10:21.0004016-06:00",
      "subtotalAmount": 1.0,
      "discountAmount": 1.0,
      "tax": 1.0,
      "outstandingBalance": 4.0,
      "paymentAmount": 1.0,
      "invoiceAmountTotal": 5.0,
      "clientID": "sample string 6",
      "clientName": "sample string 7",
      "pdfLink": "sample string 8"
    },
    {
      "invoiceNumber": "sample string 1",
      "invoiceDate": "2017-12-14T11:10:21.0004016-06:00",
      "dueDate": "2017-12-14T11:10:21.0004016-06:00",
      "subtotalAmount": 1.0,
      "discountAmount": 1.0,
      "tax": 1.0,
      "outstandingBalance": 4.0,
      "paymentAmount": 1.0,
      "invoiceAmountTotal": 5.0,
      "clientID": "sample string 6",
      "clientName": "sample string 7",
      "pdfLink": "sample string 8"
    }
  ],
  "cardholderName": "sample string 7",
  "billingAddress": "sample string 8",
  "billingCity": "sample string 10",
  "billingCountry": "sample string 11",
  "duration": 12,
  "billingZipCode": "sample string 13",
  "billingStateCode": "sample string 14",
  "enableClientSidePostBack": true,
  "clientSideReturnAddress": "sample string 19",
  "hideCustomerHeaderLogo": true
}

Invoices Array

Within the Invoice request object, there is an Invoices array. Sending multiple Invoice arrays within a single request will add multiple line items to the Invoice when it is opened in a browser. Below is a breakdown of the invoice array.

InvoiceNumberRequired Field in request indicating the Invoice number from customer to attach to each invoice payment page; (64 Chars Max).
InvoiceDateRequired Field in request indicating the Invoice Date of each invoice displayed on the invoice payment page.
DueDateRequired Field in request indicating the Invoice Due Date of each invoice displayed on the invoice payment page.
SubtotalAmountOptional Field in request for subtotal amount of each invoice in invoice payment request.
DiscountAmountOptional Field in request for discount amount applied off each invoice total display on invoice payment page.
TaxOptional Field in request for tax amount of subtotal applied to each invoice total display on invoice payment page.
OutstandingBalanceRequired Field in request for outstanding amount remaining amount for each payment amount displayed on invoice payment page.
PaymentAmountOptional Field in request for suggested payment amount off outstanding balance for each invoice displayed on invoice payment page.
InvoiceAmountTotalOptional Field in request for total amount of invoice request that includes total = (subtotal - discountAmount + tax) of each invoice total displayed on invoice payment page.
ClientIDOptional Field in request for Client ID applied to each invoice on invoice payment page.
ClientNameOptional Field in request for Client Name applied to each invoice on invoice payment page.
PDFLinkOptional Field in request for External link to invoice in PDF format to be shown on click event after each invoice on invoice payment page.