Method
client . invoice . getInvoices ( params : GetInvoicesParams ): Promise < any >
Retrieves invoice information from the supplier based on query criteria such as product ID, reference number, or date range.
Parameters
Product identifier for filtering invoices
The type of query to perform (e.g., “PO”, “Invoice”, “Customer”)
Reference number for filtering invoices. Can be a PO number, invoice number, or customer reference depending on queryType.
Specific date to query for invoices (format: YYYY-MM-DD)
Timestamp for filtering invoices. Returns invoices created or modified after this time.
Returns
Returns a Promise that resolves to the invoice data. The response format depends on the client’s configured format (JSON or XML).
Array of invoice objects Date the invoice was created
Associated purchase order number
Currency code for the invoice (e.g., “USD”, “CAD”)
Array of line items on the invoice Show line item properties
Example
import { PromoStandards } from 'promostandards-sdk-js' ;
const client = new PromoStandards . Client ({
id: 'your_account_id' ,
password: 'your_password' ,
endpoints: [
{
type: 'Invoice' ,
version: '1.0.0' ,
url: 'https://supplier.com/invoice' ,
},
],
});
const invoices = await client . invoice . getInvoices ({
productId: 'TSHIRT-001' ,
queryType: 'PO' ,
referenceNumber: 'PO-12345' ,
});
console . log ( invoices );
Example with Timestamp
// Get all invoices modified after a specific time
const recentInvoices = await client . invoice . getInvoices ({
productId: 'TSHIRT-001' ,
queryType: 'PO' ,
availableTimeStamp: '2024-01-01T00:00:00Z' ,
});
console . log ( recentInvoices );