Retrieve an invoice
GET /invoices/:invoiceid
Facade POS
MERCHANT
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
Parameter | Description | Type | Presence |
---|---|---|---|
?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. | string | Mandatory |
&dateStart= | the start of the date window to query for invoices. Format YYYY-MM-DD | string | Mandatory |
&dateEnd= | the end of the date window to query for invoices. Format YYYY-MM-DD | string | Mandatory |
&status= | the invoice status you want to query on | string | Optional |
&orderId= | the optional order id specified at time of invoice creation | string | Optional |
&limit= | maximum results that the query will return (useful for paging results) | number | Optional |
&offset= | number of results to offset (ex. skip 10 will give you results starting with the 11th result) | number | Optional |
Headers
Fields | Description | Presence |
---|---|---|
X-Accept-Version | Must be set to 2.0.0 for requests to the BitPay API. | Mandatory |
Content-Type | must be set to application/json for requests to the BitPay API. | Mandatory |
X-Identity | the 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-Signature | header 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);