/cancel




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

/cancel does not require an idempotencyKey. Server-side idempotency is enforced via the order ID — repeated cancel calls for the same order are safe.



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.



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