/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, 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 (orderSessionKey):
POST /v1/orders/{id}/cancel— the standard cancellation, used once the FlexFactororderSessionKeyis 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/evaluateresponse timed out). It identifies the order by your own external order ID. See external-cancel below.
Prerequisites to invoke this API:
- Authenticate and send the bearer token for this call.
Idempotency
/canceldoes not require anidempotencyKey. Server-side idempotency is enforced via the order ID — repeated cancel calls for the same order are safe.
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 orderSessionKey returned by /evaluate and/or /outcome and/or webhook and/or batch response file. |
| Authentication | Bearer Token |
Body
This API doesn't require body parameters.
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 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 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 10 days ago
