Skip to main content

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

productId
string
required
Product identifier for filtering invoices
queryType
string
required
The type of query to perform (e.g., “PO”, “Invoice”, “Customer”)
referenceNumber
string
Reference number for filtering invoices. Can be a PO number, invoice number, or customer reference depending on queryType.
requestedDate
string
Specific date to query for invoices (format: YYYY-MM-DD)
availableTimeStamp
string
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).
InvoiceArray
array
Array of invoice objects

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);

Build docs developers (and LLMs) love