GET /receipts (v1)

Note

This resource will be deprecated in favour of GET /receipts (v2). New code is encouraged to use the v2 resource.

Get a list of receipts.

Query parameters:

Name

Type

Description

pretty

boolean, optional, default: false

readable output formatting

consumer

string vector, optional, min: 1, max: 5

one or more consumer identifiers

count

integer, optional, min: 1, max: 20, default: 20

number of returned receipts

id

string vector, optional, min: 1, max: 20

one or more receipt identifiers

store_id

integer vector, optional, min: 1, max: 5

one or more store identifiers

store_reference

integer or string vector, optional, min: 1, max: 5

one or more store references

transaction_id

string vector, optional, min: 1, max: 20

one or more transaction identifiers

newer

string, optional

return receipts newer than this

older

string, optional

return receipts older than this

Example request:

This request will fetch up to 20 of the most recent receipts.

GET /receipts?consumer=1001 HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json

Example response:

This response contains a single receipt with a single item. See Receipt Object for a description of the format.

HTTP/1.1 200 OK
Content-Length: 1242
Content-Type: application/json; charset=UTF-8

[
  {
    "id": "513e2391ee5e525ff9000000",
    "identifier": "1001",
    "incomplete": false,
    "items": [
      {
        "discounts": [],
        "name": "Cufflinks",
        "net": null,
        "properties": {
          "category": "Accessories"
        },
        "quantity": 1,
        "total": 10.0,
        "vat": {
          "amount": 0.0,
          "rate": 0.0
        }
      }
    ],
    "localtime": "2013-04-30T14:57:00+01:00",
    "net": null,
    "payments": [
      {
        "amount": 10.0,
        "method": "cash"
      }
    ],
    "pos_data_ids": [
      "52a877d0d535cf5070e84e34"
    ],
    "properties": {},
    "retailer": {
      "name": "Paperless Fashion",
      "vatno": null
    },
    "store": {
      "address": [
        "61 Hatton Garden"
      ],
      "city": "London",
      "country": "GBR",
      "name": "Paperless Fashion Clerkenwell",
      "phone": "+440000000000",
      "postcode": "EC1N 8LS",
      "properties": {}
    },
    "store_reference": "1",
    "till_uuid": "03b8fc59-cd41-4880-810c-543a34cc0528",
    "timestamp": "2013-04-30T13:57:00+00:00",
    "total": 10.0,
    "transaction_id": "0011120008",
    "vat": [
      {
        "amount": 0.0,
        "rate": 0.0
      }
    ]
  }
]

Pagination

The newer and older, query parameters are used for pagination, and the (optional) count parameter can be used to limit the amount of results on each ‘page’. When specifying neither newer nor older, the most recent receipts will be returned.

Older receipts

To fetch receipts older than the current set of receipts being viewed, use the older query parameter with the oldest currently viewed receipt.

Example

First fetch the most recent five receipts:

GET /receipts?consumer=1001&count=5 HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
HTTP/1.1 200 OK
Content-Length: 6798
Content-Type: application/json; charset=UTF-8

[
  {"id": "61a4f7de7b6dcbd5ddcef006", ...},
  {"id": "61a4e27b707b8e9698184b50", ...},
  {"id": "61a39e20c8a664aff09b39aa", ...},
  {"id": "619e02d8a96f79f3e70e8ea4", ...},
  {"id": "619a37d778dbed5ad8ab7629", ...}
]

Then fetch the next page of five older receipts, using the last receipt:

GET /receipts?consumer=1001&count=5&older=619a37d778dbed5ad8ab7629 HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
HTTP/1.1 200 OK
Content-Length: 7684
Content-Type: application/json; charset=UTF-8

[
  {"id": "619a0da79d8a594284a0e33f", ...},
  {"id": "619902028d8d982464c4c1dd", ...},
  {"id": "6198caafca888a50b6d88255", ...},
  {"id": "6197c41f7c347af0102929b1", ...},
  {"id": "619790cf3b1b8d01fb33c6cc", ...}
]

This can be repeated until no further results are returned:

GET /receipts?consumer=1001&count=5&older=619790cf3b1b8d01fb33c6cc HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json

Newer receipts

To fetch receipts newer than the current set of receipts being viewed, use the newer query parameter with the most recent currently viewed receipt.

Example

Starting from a set of older receipts:

GET /receipts?consumer=1001&count=5&older=619a37d778dbed5ad8ab7629 HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
HTTP/1.1 200 OK
Content-Length: 7684
Content-Type: application/json; charset=UTF-8

[
  {"id": "619a0da79d8a594284a0e33f", ...},
  {"id": "619902028d8d982464c4c1dd", ...},
  {"id": "6198caafca888a50b6d88255", ...},
  {"id": "6197c41f7c347af0102929b1", ...},
  {"id": "619790cf3b1b8d01fb33c6cc", ...}
]

Then fetch the previous page of five newer receipts, using the first receipt:

GET /receipts?consumer=1001&count=5&newer=619a0da79d8a594284a0e33f HTTP/1.1
Host: api.ereceipts.co.uk
Accept: application/json
HTTP/1.1 200 OK
Content-Length: 6798
Content-Type: application/json; charset=UTF-8

[
  {"id": "61a4f7de7b6dcbd5ddcef006", ...},
  {"id": "61a4e27b707b8e9698184b50", ...},
  {"id": "61a39e20c8a664aff09b39aa", ...},
  {"id": "619e02d8a96f79f3e70e8ea4", ...},
  {"id": "619a37d778dbed5ad8ab7629", ...}
]

Like with the older query parameter, this process can be repeated until no receipts are returned.