/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 cancelled and the order.expired webhook fires. The window is measured from the order's last update and can be set per merchant.
📘

Idempotency

idempotencyKey is optional on /capture, and we recommend sending one on every request. A double capture is always prevented on (orderId, amount, currency), with or without a key. 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 returns 409. A key that is not a GUID returns 400. See the Idempotency reference (§3.4).



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

Capture workflow


Request

Details

HTTP MethodPOST
Endpoint
* Sandbox
https://api-sandbox.flexfactor.io/v1/capture
Endpoint
* Production
https://api.flexfactor.io/v1/capture
AuthenticationBearer Token

Body

Property NameTypeRequiredOptimization RankNotes
idempotencyKeyGuidOptional, recommended—Generate a GUID and reuse it on retries. A double capture is always prevented on (orderId, amount, currency); the key also replays the original response within 24 hours and returns 409 when reused with a different payload. A value that is not a GUID returns 400. See Idempotency.
orderIdGuidRequiredRequiredThe FlexFactor orderId returned by /evaluate. (The response also includes orderSessionKey; orderId is preferred.)
amountintRequiredRequiredThe amount to capture from the order. In cents
currencystringRequiredRequiredThe 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 Code200
Response BodyEnvelope with status = SUCCESS | FAILED (capture outcome); result is always null

resultstringAlways null on this endpoint. Do not use it.
statusstringCapture outcome: SUCCESS | FAILED. Key your logic on this field.
successbooleantrue when errors is empty. Stays true on a processor capture failure — do not use it to judge the capture.
statusCodestringAlways null on this endpoint. It is not the HTTP status code.
errorsarray of objectsError details; empty when the capture succeeded. Each item is serialized positionally: item1 message, item2 key, item3 error code, item4 friendly flag (boolean).
customPropertiesobjectAdditional custom properties for the API request Optional

HTTP status codes

SituationHTTPBody
Capture succeeded200status: SUCCESS, success: true
Processor did not capture the funds200status: FAILED; success remains true
Capture not enabled on the account, order not in capturerequired, amount / currency do not match the order, or idempotencyKey is not a GUID400Validation problem details — see Error Handling
Invalid or expired bearer token401—
No order matches orderId, or it belongs to another merchant404Problem details
Same idempotencyKey reused with a different body, or the first request is still running409Problem details — see Idempotency §3.4
Earlier attempt with the same key failed with an unknown outcome500Problem details
Unexpected error during the capture500Plain text Capture call failed
Duplicate-request check temporarily unavailable503Problem details, with a Retry-After header; safe to retry

Payload examples

Request

curl --request POST \
    --url https://api-sandbox.flexfactor.io/v1/capture \
		--header 'Authorization: Bearer {bearer_token_returned_by_oauth2}' \	//replace with bearer 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": {}
}

Did this page help you?