/cancel
Cancel pending orders before they are captured by FlexFactor.
Merchant Initiated Transactions (MIT) are sent to FlexFactor for an asynchronous evaluation.
If the customers cancel their subscriptions while they are pending over at FlexFactor, you can cancel them by using the /cancel endpoint.
/cancel behaves like a VOID: it stops a rescue that has not yet been captured, rather than reversing a settled charge. You can cancel:
- MIT orders in
Draft,Processing, orCAPTUREREQUIREDstate - CIT orders in
CAPTUREREQUIREDstate
To reverse a charge that has already been captured, use /refund instead.
Two endpoints are available, depending on whether you have already received the FlexFactor order ID (orderId, returned by /evaluate alongside orderSessionKey):
POST /v1/orders/{id}/cancel— the standard cancellation, used once the FlexFactororderIdis known.POST /v1/orders/{external-order-id}/external-cancel— a standard alternative that identifies the order by your own external order ID, usable at any time. It is especially useful when the FlexFactor order ID was never received (for example, the/evaluateresponse timed out). See external-cancel below.
Prerequisites to invoke this API:
- Authenticate and send the bearer token for this call.
IdempotencyNeither
/cancelnor/external-cancelrequires anidempotencyKey— idempotency is enforced server-side via the order ID, so repeated cancel calls for the same order are safe.You may include an optional
idempotencyKey(a GUID, in the JSON body). When present, a retry within the 24-hour replay window replays the original response, and a reused key with a different payload is rejected as a409conflict. Because/external-cancelis keyed by the same underlying order as/cancel, issuing both for one order collapses into a single operation. See the Idempotency reference (§3.4) for the full behavior.
Request
Details
| HTTP Method | POST |
| Endpoint - Sandbox | https://api-sandbox.flexfactor.io/v1/orders/{id}/cancel |
| Endpoint - Production | https://api.flexfactor.io/v1/orders/{id}/cancel |
| {id} | FlexFactor unique transaction identifier.\ This is the FlexFactor orderId returned by /evaluate and/or GET /v1/orders/{id} and/or webhook and/or batch response file. |
| Authentication | Bearer Token |
Body
This API doesn't require body parameters. A POST with an empty body ({}) is valid. You may optionally include an idempotencyKey (GUID) to make retries safe — see Idempotency.
Response
| Status Code | 200 |
| Response Body | Empty |
Updating the status orderAfter receiving a successful response from /cancel, you need to update this order in your CRM with the corresponding status.
Payload examples
Request
curl --request POST \
--url https://api-sandbox.flexfactor.io/v1/orders/{id}/cancel \ //insert the orderId returned by the response to /evaluate
--header 'Authorization: Bearer abc123def456' \ //replace with bearer returned by /oauth2
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{}Response
HTTP/1.1 200 OK
Content-Type: application/json
{}Cancel by external order ID
external-cancel identifies the order by your own external order ID (the orderId you sent to /evaluate) instead of the FlexFactor order ID returned in the response. It is a routine cancel path you can use at any time an order is cancellable — and it is especially useful when the FlexFactor order ID was never received, for example when the /evaluate response timed out.
Request
Details
| HTTP Method | POST |
| Endpoint - Sandbox | https://api-sandbox.flexfactor.io/v1/orders/{external-order-id}/external-cancel |
| Endpoint - Production | https://api.flexfactor.io/v1/orders/{external-order-id}/external-cancel |
| {external-order-id} | Your own external order ID — the orderId you sent in the original /evaluate request. |
| Authentication | Bearer Token |
Body
This API doesn't require body parameters.
Response
| Status Code | 200 |
| Response Body | Empty |
Payload examples
Request
curl --request POST \
--url https://api-sandbox.flexfactor.io/v1/orders/{external-order-id}/external-cancel //insert the orderId you sent to /evaluate
--header 'Authorization: Bearer abc123def456' \ //replace with bearer returned by /oauth2
--header 'accept: application/json'The request body is empty.
Response
HTTP/1.1 200 OKUpdated 22 days ago

