Fetch a list of purchases

Use the Purchase API to fetch purchase information from purchases made with Zettle. For example, the purchase information is consumed in integrations with accounting systems and inventory updates. The following describes how to retrieve multiple purchases for merchant.

Prerequisites

  • Authorisation setup with the correct scope, and a valid authorisation token. See Purchase concept.

Fetch a list of purchases

Returns a list of purchases for a merchant. Purchases up to three years old are available for fetching.

1
GET /purchases/v2

You can limit the request through the following query parameters:

  • Retrieve next page of purchases using lastPurchaseHash.
  • Start/end dates using startDateand endDate.
  • Maximum number of records to return using limit.
  • Most recent purchases first in response using descending.

See Purchase API reference for more details about query parameters.

Example: Fetch all purchases for a merchant. This is done in multiple steps as described in the following.

Step 1: Send a request with the limit parameter set to 50 to define the number of purchases to retrieve.

1
GET /purchases/v2?limit=50&descending=true

Step 2: At the bottom of the response, find the values of lastPurchaseHash.

1
{
2
"purchases": [
3
....
4
],
5
"firstPurchaseHash": "14233908814696HbDrnUNRji5iniGikNLiQ",
6
"lastPurchaseHash": "1423390928355zj9yI1wyTvqP46AG8NEaYg",
7
"linkUrls": [
8
"<https://purchase.izettle.com/purchases/v2?limit=50&descending=true&lastPurchaseHash=1423390928355zj9yI1wyTvqP46AG8NEaYg>; rel=\"next\""
9
]
10
}

Step 3: Send another request with these settings: The limit parameter the same as in the initial request; lastPurchaseHash with the value from the previous response.

1
GET /purchases/v2?limit=50&lastPurchaseHash=1423390928355zj9yI1wyTvqP46AG8NEaYg

Step 4: Repeat step 2 and step 3 until the response is empty.