Retrieve an Invoice

Retrieve an invoice

GET /invoices/:invoiceid

Facade POS MERCHANT

HTTP Request

To get the generated invoice details, pass the Invoice Id with URL parameter

let invoice = await client.GetInvoice(invoice.id);

Retrieve invoices filtered by query

Facade MERCHANT

HTTP Request

URL Parameters

ParameterDescriptionTypePresence
?token=When fetching an invoice via the merchant or the pos facade, pass the API token as a URL parameter - the same token used to create the invoice in the first place.stringMandatory
&dateStart=the start of the date window to query for invoices. Format YYYY-MM-DDstringMandatory
&dateEnd=the end of the date window to query for invoices. Format YYYY-MM-DDstringMandatory
&status=the invoice status you want to query onstringOptional
&orderId=the optional order id specified at time of invoice creationstringOptional
&limit=maximum results that the query will return (useful for paging results)numberOptional
&offset=number of results to offset (ex. skip 10 will give you results starting with the 11th result)numberOptional

Headers

FieldsDescriptionPresence
X-Accept-VersionMust be set to 2.0.0 for requests to the BitPay API.Mandatory
Content-Typemust be set to application/json for requests to the BitPay API.Mandatory
X-Identitythe hexadecimal public key generated from the client private key. This header is required when using tokens with higher privileges (merchant facade). When using standard pos facade token directly from the BitPay dashboard (with "Require Authentication" disabled), this header is not needed.Mandatory
X-Signatureheader is the ECDSA signature of the full request URL concatenated with the request body, signed with your private key. This header is required when using tokens with higher privileges (merchant facade). When using standard pos facade token directly from the BitPay dashboard (with "Require Authentication" disabled), this header is not needed.Mandatory

To get the generated invoices filtered by query parameters

let date = new Date();
let dateEnd = new Date().toISOString().split('T')[0];
let dateStart = new Date(date.setDate(date.getDate()-30)).toISOString().split('T')[0];

let status = InvoiceStatus.New;
let limit = 30;
let offset = 0;
let retrievedInvoices;

retrievedInvoices = await client.GetInvoices(dateStart, dateEnd, status, null, limit, offset);