DESCRIPTION
Update the payment status of an invoice.
URL STRUCTURE
https://[hostname]/finance/interface/payment-status
METHOD
POST
HEADERS
**Authorization:**
string Base64 [email]:[key]
BODY
Name | Type | Description |
---|---|---|
invoiceStatus[] | array | Array of variables for the payment status. |
invoiceStatus[invoiceId] | int | Equinox Invoice ID. |
invoiceStatus[status] | enum | Either string or int of the payment status. |
invoiceStatus[paymentDate] | datetime | Date the payment was made. |
invoiceStatus[amount] | double | Amount of part paid (optional). |
For example:
{ "invoiceStatus": { "invoiceId": 123456, "status": 1 "paymentDate": "2020-02-20" "amount": 200.20 } }
ENUMS
status
Value For API | Definition |
0 | Unpaid |
1 | Paid |
2 | Part Paid |
3 | Disputed |
4 | Written Off |
5 | Cancelled |
RETURNS
Sample response: Invoice data
{
"id": "4544",
"legalEntityId": "2",
"locationId": "34",
"invoiceDate": "2019-07-01",
"paymentDate": "2019-09-03",
"invoiceNumber": "INV123",
"status": "2",
"partPaid": null,
"amount": "123.40",
"amountCurrency": "EUR",
"VATAmount": "25.91",
"location": "343"
"charges": [],
}
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>invoice object</returns>
public static async Task<object> SendPaymentStatus(string userEmail, string password, Filestream document)
{
dynamic obj = null;
string url = "https://[hostname]/finance/interface/payment-status";
int invoiceId = 4544;
string status = "Paid";
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 StringContent(invoiceId.toString()), "invoiceStatus[invoiceId]");
form.Add(new StringContent(status), "invoiceStatus[status]");
form.Add(new StringContent(paymentDate), "invoiceStatus[paymentDate]");
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;
}