API Reference
Resources
Update a capture
How to update an existing capture via API
To update an existing capture, send a PATCH request to the /api/captures/:id endpoint, where id is the ID of the resource that you want to update.
Here below the list of all the possible arguments that you can pass with the request body.

Request

PATCH https://yourdomain.commercelayer.io/api/captures/:id

Arguments

Body Parameter
Type
Required
type
string
Required
id
string
Required
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
attributes._refund
boolean, value is 'true'
Optional
attributes._refund_amount_cents
integer
Optional

Example

Request
Response
The following request updates the capture identified by the ID "xYZkjABcde":
1
curl -g -X PATCH \
2
'https://yourdomain.commercelayer.io/api/captures/xYZkjABcde' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "captures",
9
"id": "xYZkjABcde",
10
"attributes": {
11
"_refund": true,
12
"_refund_amount_cents": 500
13
}
14
}
15
}'
Copied!
On success, the API responds with a 200 OK status code, returning the updated resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "captures",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/captures/xYZkjABcde"
7
},
8
"attributes": {
9
"number": "42/T/001",
10
"currency_code": "EUR",
11
"amount_cents": 1500,
12
"amount_float": 15.0,
13
"formatted_amount": "€15,00",
14
"succeeded": false,
15
"message": "Accepted",
16
"error_code": "00001",
17
"error_detail": "Already settled",
18
"token": "xxxx-yyyy-zzzz",
19
"gateway_transaction_id": "xxxx-yyyy-zzzz",
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": "ANY-EXTERNAL-REFEFERNCE",
23
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
24
"metadata": {
25
"foo": "bar"
26
},
27
"refund_amount_cents": 500,
28
"refund_amount_float": 5.0,
29
"formatted_refund_amount": "€5,00",
30
"refund_balance_cents": 1000,
31
"refund_balance_float": 10.0,
32
"formatted_refund_balance": "€10,00"
33
},
34
"relationships": {
35
"order": {
36
"links": {
37
"self": "https://yourdomain.commercelayer.io/api/captures/xYZkjABcde/relationships/order",
38
"related": "https://yourdomain.commercelayer.io/api/captures/xYZkjABcde/order"
39
}
40
},
41
"reference_authorization": {
42
"links": {
43
"self": "https://yourdomain.commercelayer.io/api/captures/xYZkjABcde/relationships/reference_authorization",
44
"related": "https://yourdomain.commercelayer.io/api/captures/xYZkjABcde/reference_authorization"
45
}
46
},
47
"refunds": {
48
"links": {
49
"self": "https://yourdomain.commercelayer.io/api/captures/xYZkjABcde/relationships/refunds",
50
"related": "https://yourdomain.commercelayer.io/api/captures/xYZkjABcde/refunds"
51
}
52
}
53
},
54
"meta": {
55
"mode": "test"
56
}
57
}
58
}
Copied!
Last modified 20d ago
Copy link