Fetch purchase with refund

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 examples illustrate how to work with purchases and refunds.

Prerequisites

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

Fetch purchase with partial refund

Refunds are represented by the same information model as for purchases, but with negative quantity. There are also specific refund-related flags and fields, see Purchase concept.

Example: This request returns a list of purchases with partial refunds.

Request

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

Response

The response contains two objects for purchase: one for the original purchase and the other for the refund. They are linked with the UUID 6a7d7a9c-efd8-4a93-b0ff-45d55d212774.

1
{
2
"purchases": [
3
{
4
"source": "POS",
5
"purchaseUUID": "1x6BTNcFQ-esnIMUSdX8mQ",
6
"amount": -10000,
7
"vatAmount": -1071,
8
"country": "SE",
9
"currency": "SEK",
10
"timestamp": "2021-01-13T21:34:22.069+0000",
11
"gpsCoordinates": {
12
...
13
},
14
"purchaseNumber": 33,
15
"globalPurchaseNumber": 33,
16
"userDisplayName": "John Eriksen",
17
"userId": 5428764,
18
"organizationId": 37295469,
19
"products": [
20
{
21
"quantity": "-1",
22
"productUuid": "c8037b10-5381-11eb-a35d-4df8c9434273",
23
"variantUuid": "f29e9da0-5381-11eb-b308-d53bdad1e1da",
24
"vatPercentage": 12,
25
"unitPrice": 10000,
26
"rowTaxableAmount": -8929,
27
"name": "T-shirt",
28
"description": "",
29
"variantName": "Small",
30
"fromLocationUuid": "ab4b8ca6-c4d0-11e9-9f2e-2f9f3e29738c",
31
"toLocationUuid": "ab4b8d0a-c4d0-11e9-a836-71d1917b51b2",
32
"type": "PRODUCT",
33
"libraryProduct": true
34
}
35
],
36
"discounts": [],
37
"payments": [
38
{
39
"uuid": "5fdf1688-56ab-4686-857f-4ada4361a205",
40
"amount": -10000,
41
"type": "IZETTLE_CASH",
42
"references": {
43
"refundsPayment": "eb0db2eb-0ab0-4650-bd9c-492ebbe36938"
44
},
45
"attributes": {
46
"handedAmount": -10000
47
}
48
}
49
],
50
"refundsPurchaseUUID": "an16nO_YSpOw_0XVXSEndA",
51
"receiptCopyAllowed": true,
52
"references": {
53
"checkoutUUID": "d51c834e-d507-41e5-ae9e-81164bd7fe9b"
54
},
55
"created": "2021-01-13T21:34:22.069+0000",
56
"refunded": false,
57
"purchaseUUID1": "d71e814c-d705-43e7-ac9c-831449d5fc99",
58
"refundsPurchaseUUID1": "6a7d7a9c-efd8-4a93-b0ff-45d55d212774",
59
"groupedVatAmounts": {
60
"12.0": -10000
61
},
62
"refund": true
63
},
64
{
65
"source": "POS",
66
"purchaseUUID": "an16nO_YSpOw_0XVXSEndA",
67
"amount": 20000,
68
"vatAmount": 2142,
69
"country": "SE",
70
"currency": "SEK",
71
"timestamp": "2021-01-13T21:34:10.968+0000",
72
"gpsCoordinates": {
73
...
74
},
75
"purchaseNumber": 32,
76
"globalPurchaseNumber": 32,
77
"userDisplayName": "John Eriksen",
78
"userId": 5428764,
79
"organizationId": 37295469,
80
"products": [
81
{
82
"quantity": "1",
83
"variantUuid": "f29e9da0-5381-11eb-b308-d53bdad1e1da",
84
"vatPercentage": 12,
85
"unitPrice": 10000,
86
"rowTaxableAmount": 8929,
87
"name": "T-shirt",
88
"description": "",
89
"variantName": "Small",
90
"type": "PRODUCT",
91
"libraryProduct": true
92
},
93
{
94
"quantity": "1",
95
"productUuid": "c8037b10-5381-11eb-a35d-4df8c9434273",
96
"variantUuid": "f29e9da0-5381-11eb-9178-f532eaf25a4b",
97
"vatPercentage": 12,
98
"unitPrice": 10000,
99
"rowTaxableAmount": 8929,
100
"name": "T-shirt",
101
"description": "",
102
"variantName": "Medium",
103
"type": "PRODUCT",
104
"libraryProduct": true
105
}
106
],
107
"discounts": [],
108
"payments": [
109
{
110
"uuid": "eb0db2eb-0ab0-4650-bd9c-492ebbe36938",
111
"amount": 20000,
112
"type": "IZETTLE_CASH",
113
"attributes": {
114
"handedAmount": 20000
115
}
116
}
117
],
118
"refundedByPurchaseUUIDs": [
119
"1x6BTNcFQ-esnIMUSdX8mQ"
120
],
121
"receiptCopyAllowed": true,
122
"references": {
123
"checkoutUUID": "6b7c7b9d-eed9-4b92-b1fe-44d45c202675"
124
},
125
"created": "2021-01-13T21:34:10.968+0000",
126
"refunded": true,
127
"purchaseUUID1": "6a7d7a9c-efd8-4a93-b0ff-45d55d212774",
128
"refundedByPurchaseUUIDs1": [
129
"d71e814c-d705-43e7-ac9c-831449d5fc99"
130
],
131
"groupedVatAmounts": {
132
"12.0": 20000
133
},
134
"refund": false
135
}
136
],
137
"firstPurchaseHash": "16105736620691x6BTNcFQ-esnIMUSdX8mQ",
138
"lastPurchaseHash": "1610573650968an16nO_YSpOw_0XVXSEndA",
139
"linkUrls": [
140
"<https://purchase.izettle.com/purchases/v2?limit=2&descending=true&lastPurchaseHash=1610573650968an16nO_YSpOw_0XVXSEndA>; rel=\"next\""
141
]
142
}

A successful request returns Status: 200 OK.