/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, or CAPTUREREQUIRED state
  • CIT orders in CAPTUREREQUIRED state

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 (orderSessionKey):

  • POST /v1/orders/{id}/cancel — the standard cancellation, used once the FlexFactor orderSessionKey is known.
  • POST /v1/orders/{external-order-id}/external-cancel — a timeout fallback, used when a cancel must be issued before the FlexFactor order ID has been received (for example, the /evaluate response timed out). It identifies the order by your own external order ID. See external-cancel below.


❗️

Prerequisites to invoke this API:

📘

Idempotency

Neither /cancel nor /external-cancel requires an idempotencyKey — 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 a 409 conflict. Because /external-cancel is 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 MethodPOST
Endpoint - Sandboxhttps://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 orderSessionKey returned by /evaluate and/or /outcome and/or webhook and/or batch response file.
AuthenticationBearer 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 Code200
Response BodyEmpty


Updating the status order

After 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 orderSessionKey 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 before the FlexFactor order ID is received

Use external-cancel when you need to cancel an order before you have received the FlexFactor orderSessionKey — for example, when the /evaluate response timed out. This endpoint identifies the order by your own external order ID (the orderId you sent to /evaluate) instead of the FlexFactor order ID.

Request

Details

HTTP MethodPOST
Endpoint - Sandboxhttps://api-sandbox.flexfactor.io/v1/orders/{external-order-id}/external-cancel
Endpoint - Productionhttps://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.
AuthenticationBearer Token

Body

This API doesn't require body parameters.

Response

Status Code200
Response BodyEmpty

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 OK