DESCRIPTION
An incoming invoice allows the creation of charges that are relevant against the incoming ledger. If a document is supplied the document also stored on the matter.
URL STRUCTURE
https://[hostname]/finance/interface/incoming
METHOD
POST
HEADERS
**Authorization:**
string Base64 [email]:[key]
BODY
Name | Type | Description |
---|---|---|
incomingInvoice[] | array | Array of variables for the incoming invoice. |
incomingInvoice[incomingLedger] | string | The ledger to match against the charge sheet. |
incomingInvoice[matterId] | int | Equinox matter ID. |
incomingInvoice[matterCode] | string | Equinox matter code (IRN) (optional). |
incomingInvoice[amount] | double | Invoice amount, as a 2dp number, e.g., “123.40”. |
incomingInvoice[currency] | string | Currency of the invoice in 3 chars, e.g., “EUR”. |
incomingInvoice[invoiceNumber] | string | Invoice number of the incoming invoice. |
incomingInvoice[paymentReference] | string | Reference to the invoice, for WIP matching (optional). |
incomingInvoice[document] | file | Invoice document (as a pdf?) (optional). |
incomingInvoice[date] | datetime | Date and time for invoice, e.g. “2019-08-01 12:35:00”. |
For example:
{ "incomingInvoice": { "matterId": 123456, "incomingLedger": "3000", "amount": "100.00", "currency": "EUR", "date": "2020-02-20" } }
RETURNS
Sample response:
An array of created charges
[
{
"id": "252",
"userId": "1703",
"matterId": "10",
"time": null,
"date": {
"date": "2019-09-25 12:07:00",
"timezone_type": 3,
"timezone": "Europe/London"
},
"description": "TEST1",
"legalEntityId": "1",
"category": "Fixed",
"paymentReference": "Ref123",
"supportingDocId": "5175",
"notes": null,
"status": {
"statusValue": "pre-approval"
},
"amount": "123.40",
"adjustment": null,
"discount": null,
"discountPercentage": null,
"chargeRate": 0,
"potentialForVAT": 1,
"invoiceNumber": "INV123",
"chargeSheetId": "6",
"nonChargeable": "0",
"isRenewalCharge": "0"
}
]
EXAMPLE
C#
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Cryptography;
/// <summary>
/// Send an invoice to Equinox, basic example
/// </summary>
/// <param name="userEmail"></param>
/// <param name="password"></param>
/// <returns>charge object</returns>
public static async Task<object> SendInvoice(string userEmail, string password, Filestream document)
{
dynamic obj = null;
string url = "https://[hostname]/finance/interface/incoming";
string incomingLedger = "123";
int matterId = 10;
string matterCode = "P000006EP";
double amount = "123.40";
string currency = "EUR";
string invoiceNumber = "INV123";
string paymentReference = "REF123";
DateTime date = "2019-08-01 12:35:00";
// Auth headers
MD5 md5Hash = MD5.Create();
string hashedPassword = Security.GetMd5Hash(md5Hash, password);
var credentials = Convert.ToBase64String(
Encoding.ASCII.GetBytes(userEmail + ":" + hashedPassword)
);
// Content
var form = new MultipartFormDataContent();
form.Add(new StreamContent(new MemoryStream(file)), "incomingInvoice[document]", "filename.pdf");
form.Add(new StringContent(incomingLedger), "incomingInvoice[incomingLedger]");
form.Add(new StringContent(matterId.toString()), "incomingInvoice[matterId]");
form.Add(new StringContent(matterCode), "incomingInvoice[matterCode]");
form.Add(new StringContent(amount.toString()), "incomingInvoice[amount]");
form.Add(new StringContent(currency), "incomingInvoice[currency]");
form.Add(new StringContent(invoiceNumber), "incomingInvoice[invoiceNumber]");
form.Add(new StringContent(paymentReference), "incomingInvoice[paymentReference]");
form.Add(new StringContent(date.toString()), "incomingInvoice[date]");
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credentials);
// Response
HttpResponseMessage res = await client.PostAsync(url, form);
content = await res.Content.ReadAsStringAsync();
// JSON Serialise
obj = JsonConvert.DeserializeObject(content);
}
return obj;
}