GetInvoicePDF (Pull Method)
GetInvoicePDF
Retrieves the PDF of an invoice as base64‑encoded bytes, along with the invoice number and a suggested filename. Supports Normal and Supplement invoice types.
Request
| Parameter | Type | Description |
|---|---|---|
| Company | Varchar(250) | Required. Company identifier returned by GetCompanies. |
| InvoiceNumber | Varchar(50) | Required. Invoice number to fetch. |
| InvoiceType | Varchar(50) | Optional. Values: Normal, Supplement. If omitted, defaults to Normal. |
Response
| Parameter | Type | Description |
|---|---|---|
| FileName | Varchar(250) | Suggested filename of the returned file. |
| InvoiceNumber | Varchar(50) | Invoice number; pass to GetInvoiceInfo for full details. |
| FileBytes | NVarchar(max) | Base64‑encoded PDF bytes of the invoice document. |
Example (C#)
// setup request parameters
NameValueCollection getInvoicePDFParams = new NameValueCollection
{
{ "InvoiceNumber", "1317" },
{ "Company", "ABC" },
{ "InvoiceType", "Normal" } // Normal or Supplement
};
dynamic getInvoicePDFResponse = apiClient.GetInvoicePDF(getInvoicePDFParams);
// Access metadata
Console.WriteLine("Filename: " + getInvoicePDFResponse.FileName);
// Decode and save file locally
byte[] bytes = Convert.FromBase64String(Convert.ToString(getInvoicePDFResponse.FileBytes));
File.WriteAllBytes(@"C:\DownloadAPIFiles\" + Convert.ToString(getInvoicePDFResponse.FileName), bytes);