API reference
List all authorizations
How to fetch a collection of authorizations via API
To fetch a collection of authorizations, send a GET request to the /api/authorizations endpoint.

Request

GET https://yourdomain.commercelayer.io/api/authorizations

Example

Request
Response
The following request fetches a collection of authorizations:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/authorizations/' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token'
Copied!
On success, the API responds with a 200 OK status code, returning a paginated collection of resource objects:
1
{
2
"data": [
3
{
4
"id": "xYZkjABcde",
5
"type": "authorizations",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/authorizations/xYZkjABcde"
8
},
9
"attributes": {
10
"number": "42/T/001",
11
"currency_code": "EUR",
12
"amount_cents": 1500,
13
"amount_float": 15.0,
14
"formatted_amount": "€15,00",
15
"succeeded": false,
16
"message": "Accepted",
17
"error_code": "00001",
18
"error_detail": "Already settled",
19
"token": "xxxx-yyyy-zzzz",
20
"gateway_transaction_id": "xxxx-yyyy-zzzz",
21
"created_at": "2018-01-01T12:00:00.000Z",
22
"updated_at": "2018-01-01T12:00:00.000Z",
23
"reference": "ANY-EXTERNAL-REFEFERNCE",
24
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
25
"metadata": {
26
"foo": "bar"
27
},
28
"cvv_code": "000",
29
"cvv_message": "validated",
30
"avs_code": "000",
31
"avs_message": "validated",
32
"fraud_review": "passed",
33
"capture_amount_cents": 500,
34
"capture_amount_float": 5.0,
35
"formatted_capture_amount": "€5,00",
36
"capture_balance_cents": 1000,
37
"capture_balance_float": 10.0,
38
"formatted_capture_balance": "€10,00",
39
"void_balance_cents": 1500,
40
"void_balance_float": 15.0,
41
"formatted_void_balance": "€15,00"
42
},
43
"relationships": {
44
"order": {
45
"links": {
46
"self": "https://yourdomain.commercelayer.io/api/authorizations/xYZkjABcde/relationships/order",
47
"related": "https://yourdomain.commercelayer.io/api/authorizations/xYZkjABcde/order"
48
}
49
},
50
"captures": {
51
"links": {
52
"self": "https://yourdomain.commercelayer.io/api/authorizations/xYZkjABcde/relationships/captures",
53
"related": "https://yourdomain.commercelayer.io/api/authorizations/xYZkjABcde/captures"
54
}
55
},
56
"voids": {
57
"links": {
58
"self": "https://yourdomain.commercelayer.io/api/authorizations/xYZkjABcde/relationships/voids",
59
"related": "https://yourdomain.commercelayer.io/api/authorizations/xYZkjABcde/voids"
60
}
61
}
62
},
63
"meta": {
64
"mode": "test"
65
}
66
},
67
{
68
"other": "... 9 authorizations (first page)"
69
}
70
],
71
"meta": {
72
"record_count": 140,
73
"page_count": 14
74
},
75
"links": {
76
"first": "https://yourdomain.commercelayer.io/api/authorizations?page[number]=1&page[size]=10",
77
"next": "https://yourdomain.commercelayer.io/api/authorizations?page[number]=2&page[size]=10",
78
"last": "https://yourdomain.commercelayer.io/api/authorizations?page[number]=14&page[size]=10"
79
}
80
}
Copied!
Remember that when you fetch a list of resources you get paginated result.

Sortable attributes

The list of authorizations can be sorted by the following attributes:
  • number
  • amount_cents
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin