/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.
  • If you do not capture the capturerequired order, it will void after a preconfigured amount of time.
📘

Idempotency

idempotencyKey is required on /capture. A double capture is always prevented on (orderId, amount, currency) — even so, reusing the same key on a retry replays the original response (24h window) and surfaces a reused-key conflict as a 409. 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
idempotencyKeyGuidRequiredRequiredGenerate a GUID. A double capture is always prevented on (orderId, amount, currency); reusing the key on a retry also replays the original response and flags a reused-key conflict. 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.

Status Code200
Response BodyEnvelope with result = SUCCESS | FAILED (API call outcome) and status = APPROVED | DECLINED (capture decision)

resultstringOutcome of the API call: SUCCESS | FAILED
statusstringCapture decision: APPROVED | DECLINED
successbooleanIndicates if the API request was successful
statusCodestringThe status code of the API request Optional
errorsarray of stringAny errors encountered during the API request Optional
customPropertiesobjectAdditional custom properties for the API request Optional

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}",
  "orderId": "{same_orderId_returned_by_/evaluate_for_that_order}",
  "amount": 10000,
  "currency": "USD"
}

Response


HTTP/1.1 200 OK
Content-Type: application/json

{
   "result": "SUCCESS | FAILED",
   "status": "APPROVED | DECLINED",
   "success": true,
   "statusCode": null,
   "errors": [],
   "customProperties": {}
}

Did this page help you?