/capture
This API allows you to CAPTURE an order in capturerequired status.
Prerequisites to invoke this API:
- Authenticate and send the bearer token for this call.
- Capture must be called within 5 minutes of the authorize response by default — this applies to all authorize flows. If no capture arrives within that window, the order expires: its status becomes
cancelledand theorder.expiredwebhook fires. The window is measured from the order's last update and can be set per merchant.
Idempotency
idempotencyKeyis optional on/capture, and we recommend sending one on every request. When you send a key, a retry with the same key replays the original response within 24 hours, and the same key with a different payload returns409. See the Idempotency reference (§3.4).Without a key, nothing is stored and no response is replayed. A second capture of the same order does not capture twice: it returns
400with the messageOrder is already in APPROVED state. That400does not carry the result of the first request.Stored responses. A capture that returned
status: FAILED, a400, or a404is also stored against the key and replayed. To attempt the capture again, send a new key.The key must be a GUID. A value that is not a GUID returns HTTP
500with an empty body, and the order is not captured.
Workflow
According to your configuration, a call to /evaluate or /orders can return the status CAPTURE REQUIRED.
In that scenario, you will need to invoke /capture, and then update the definitive status with /orders.

Capture workflow
Request
Details
| HTTP Method | POST |
| Endpoint * Sandbox | https://api-sandbox.flexfactor.io/v1/capture |
| Endpoint * Production | https://api.flexfactor.io/v1/capture |
| Authentication | Bearer Token |
Body
| Property Name | Type | Required | Optimization Rank | Notes |
|---|---|---|---|---|
idempotencyKey | Guid | Optional, recommended | — | Generate a GUID and reuse it on retries. The key replays the original response within 24 hours and returns 409 when reused with a different payload. A value that is not a GUID returns 500. See Idempotency. |
orderId | Guid | Required | Required | The FlexFactor orderId returned by /evaluate. (The response also includes orderSessionKey; orderId is preferred.) |
amount | int | Optional | Required | The amount to capture, in cents. It must equal the amount that remains to capture on the order: the order amount minus any partial voids. A request without amount captures the full remaining amount. We recommend sending it, so that a difference from your own records returns 400 instead of a capture. |
currency | string | Required | Required | The ISO 4217 currency code for the transaction. |
Response
After receiving a response from /capture, you need to update this order in your CRM with the corresponding status.
The response uses the common FlexFactor envelope. status is the capture outcome: SUCCESS or FAILED. result is never populated on this endpoint, and success stays true when the processor declines the capture, so key your logic on status alone. HTTP 200 with status: FAILED means the funds were not captured. The envelope and the transaction state model are defined in Workflows §3.5.
| Status Code | 200 |
| Response Body | Envelope with status = SUCCESS | FAILED (capture outcome); result is always null |
result | string | Always null on this endpoint. Do not use it. |
status | string | Capture outcome: SUCCESS | FAILED. Key your logic on this field. |
success | boolean | true when errors is empty. Stays true on a processor capture failure — do not use it to judge the capture. |
statusCode | string | Always null on this endpoint. It is not the HTTP status code. |
errors | array of objects | Error details; empty when the capture succeeded. Each item is serialized positionally: item1 message, item2 key, item3 error code, item4 friendly flag (boolean). |
customProperties | object | Additional custom properties for the API request Optional |
HTTP status codes
| Situation | HTTP | Body |
|---|---|---|
| Capture succeeded | 200 | status: SUCCESS, success: true |
| Processor did not capture the funds | 200 | status: FAILED; success remains true |
The account, the order, amount, or currency failed a validation rule — see Validation errors | 400 | Validation problem details; errors maps a key to its messages |
| Invalid or expired bearer token | 401 | — |
No order matches orderId, or it belongs to another merchant | 404 | Problem details |
Same idempotencyKey reused with a different body, or the first request is still running | 409 | Problem details — see Idempotency §3.4 |
idempotencyKey is not a GUID | 500 | Empty |
| Unexpected error during the capture | 500 | Plain text Capture call failed |
| Duplicate-request check temporarily unavailable | 503 | Problem details, with a Retry-After header; safe to retry |
For the error key and the message of each 400 on this endpoint, see Error Messages: /capture.
Validation errors
A 400 names each cause in the errors object of the problem details. When several rules fail, the response carries all of them.
| Key | Message | Cause |
|---|---|---|
Merchant | Capture is not enabled for this account. Please contact administrator. | Capture is not enabled for your account |
Order | Order is already in APPROVED state | The order is already captured |
Order | Order is not in CAPTUREREQUIRED state | The order is not awaiting capture, for example because it was cancelled or the capture window elapsed |
Amount | Amount mismatch. Please provide the correct amount (<remaining>) | amount does not equal the amount that remains to capture on the order. <remaining> is that amount, in cents |
Currency | Currency mismatch. Please provide the correct currency (<currency>) | currency is missing, or does not match the currency of the order. The comparison ignores case |
Payload examples
Request
curl --request POST \
--url https://api-sandbox.flexfactor.io/v1/capture \
--header 'Authorization: Bearer {bearer_token_returned_by_oauth2}' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"idempotencyKey": "{generate_a_GUID_and_reuse_it_on_retries}",
"orderId": "{same_orderId_returned_by_/evaluate_for_that_order}",
"amount": 10000,
"currency": "USD"
}
'Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"result": null,
"status": "SUCCESS | FAILED",
"success": true,
"statusCode": null,
"errors": [],
"customProperties": {}
}Updated 5 days ago

