Capture, cancel, void, and refund
Certification cases for /capture, /cancel, /void, and /refund.
Part of the Certification guide. Mark your scope on that page before you run these cases. Base payloads and test cards are on the Reference page.
8. Capture
Applies to: CIT-AUTHORIZE, MIT-ASYNC-AUTHORIZE, SYNC-MIT. /capture requires the FlexFactor orderId, amount in cents, and currency. idempotencyKey is optional on the API, and this guide requires it on every capture so that a retry after a timeout replays the original response. The amount must equal the amount that remains to capture, and the currency must match the authorization. A second capture of the same order under a new key, or without a key, returns HTTP 400 and does not capture twice.
The response status is the capture outcome: SUCCESS or FAILED. result is always null on this endpoint, and success stays true when the processor declines the capture, so key your logic on status alone. The full capture is proved by CIT-AUTHORIZE-02, MIT-ASYNC-AUTHORIZE-03, or SYNC-MIT-04; the cases below reuse that order or a new authorization from the same flow.
Reference: /capture, /capture HTTP status codes, Appendix A.3.
| ID | Scenario | Setup / action | Expected result | Evidence |
|---|---|---|---|---|
| CAPTURE-01 | Replay with the same key | Repeat the capture from CIT-AUTHORIZE-02, MIT-ASYNC-AUTHORIZE-03, or SYNC-MIT-04 with the same idempotencyKey | HTTP 200; the original response is replayed; GET shows one capture in activityItems | Both responses |
| CAPTURE-02 | Double capture with a new key | Repeat the same capture with a new idempotencyKey | HTTP 400; no second capture; totalBalancePaid is unchanged | Response, order balance |
| CAPTURE-03 | Amount does not match the authorization | Authorize 9900 cents, then capture 6000 cents, then capture 12000 cents | HTTP 400 both times; GET still returns status capturerequired; totalBalancePaid is unchanged | Responses, order balance |
Partial capture is not availableThe capture amount must equal the amount that remains to capture: the authorized amount minus any partial voids. CAPTURE-03 proves that a lower amount is rejected. To reduce an order before capture, void part of it with /void and capture the remaining amount (Section 9.2). To return part of a charge after capture, use /refund with a partial amount.
9. Cancel and void
Two endpoints release an order before capture. /cancel in 9.1 always releases the full order amount. /void in 9.2 releases the full amount or part of it, and its cases apply only when you use that endpoint.
9.1 Cancel
Applies to: CIT-AUTHORIZE, MIT-ASYNC-PURCHASE, MIT-ASYNC-AUTHORIZE, SYNC-MIT. Cancel is a void. It applies to MIT orders in any state other than Completed or Cancelled (Draft, Onhold, Processing, Capturerequired) and to CIT orders in Capturerequired or Onhold. A captured order must be refunded instead. The only accepted body field is the optional idempotencyKey; there is no amount or currency field, and a cancel always applies to the full order amount. CANCEL-04 is required only if your integration calls /external-cancel; otherwise mark it Not applicable.
A cancel returns HTTP 200 with two fields, success and responseMessage. It does not use the common envelope. Read success. The same body is returned when the order was not in a cancellable state and nothing changed, so a 200 does not by itself prove that the order was cancelled. Mark the order cancelled only after GET /v1/orders/{id} returns status cancelled or order.cancelled arrives.
Reference: /cancel, /cancel response, Workflows §2.6.
| ID | Scenario | Setup / action | Expected result | Evidence |
|---|---|---|---|---|
| CANCEL-01 | Cancel a CIT authorization (CIT-AUTHORIZE) | POST /v1/orders/{orderId}/cancel with {} on a capturerequired CIT order | HTTP 200; success true; GET returns status cancelled; order.cancelled received when WEBHOOKS is In | orderId |
| CANCEL-02 | Cancel a pending MIT order (MIT-ASYNC-PURCHASE, MIT-ASYNC-AUTHORIZE, SYNC-MIT) | Cancel an order in draft or processing | HTTP 200; success true; order.cancelled received; GET returns status cancelled | Webhook IdempotencyKey |
| CANCEL-03 | Cancel an MIT authorization (MIT-ASYNC-AUTHORIZE) | Cancel an order after order.capturerequired and before capture | HTTP 200; GET returns status cancelled; no funds captured; order.cancelled received | orderId |
| CANCEL-04 | Cancel by external order ID (required only if your integration calls /external-cancel) | POST /v1/orders/{external-order-id}/external-cancel with your merchant orderId on a pending order | HTTP 200 with the same body; GET returns status cancelled | Response |
| CANCEL-05 | Cancel that changes nothing | Repeat CANCEL-01 on the same order, then cancel an order in status completed | HTTP 200 with the same body both times; the first order remains status cancelled and the second remains status completed; no order.cancelled event; nothing is refunded | Responses, webhook count |
Partial cancel is not availableA cancel releases the full order amount. The request body accepts no
amountorcurrencyfield. To release part of an order, use /void (Section 9.2).
9.2 Void
Applies to: VOID. POST /v1/void names the order in the request body, by the FlexFactor orderId or by your own order ID in orderExternalId. It takes a required idempotencyKey and an optional amount in cents. An amount equal to the order amount, or a request without amount, is a full void and cancels the order. A lower amount is a partial void: the order keeps its pre-capture state, its payableAmount drops by the voided value while amount stays the same, and you capture the remainder later. Only an order in Capturerequired state can be voided. Partial voids must be enabled for your sandbox account. Send a new idempotencyKey on every void and reuse it only on retries. VOID-06 is required only if your integration sends orderExternalId; otherwise mark it Not applicable.
Read success in the response, then confirm the order with GET /v1/orders/{id}. The response also returns status (SUCCESS or FAILED), voidedAmount, remainingAuthorizedAmount, and cancelled. A void that the processor does not apply returns HTTP 500 with status FAILED. The cases below use a new 9900-cent authorization in Capturerequired state from CIT-AUTHORIZE, MIT-ASYNC-AUTHORIZE, or SYNC-MIT unless the case says otherwise.
Reference: /void, /void HTTP status codes, Appendix A.5.
| ID | Scenario | Setup / action | Expected result | Evidence |
|---|---|---|---|---|
| VOID-01 | Full void | POST /v1/void with the FlexFactor orderId, amount 9900, and a new idempotencyKey | HTTP 200; success true; GET returns status cancelled; order.cancelled received when WEBHOOKS is In | orderId, response |
| VOID-02 | Partial void | amount 4000 with idempotencyKey K1 on a new order | HTTP 200; success true; GET returns the same status as before the void, payableAmount 59.00, and amount 99.00; no order.cancelled event | orderId, response |
| VOID-03 | Partial void retry with the same key | Repeat VOID-02 with K1 | HTTP 200; the original response is replayed; payableAmount stays 59.00 | Both responses |
| VOID-04 | Second distinct partial void | amount 1000 with a new key K2 on the VOID-02 order | HTTP 200; success true; GET returns payableAmount 49.00 | Response |
| VOID-05 | Capture the remainder | /capture with amount 4900 on the VOID-04 order | HTTP 200; status SUCCESS; GET returns status completed and totalBalancePaid 49.00 | Response, order balance |
| VOID-06 | Partial void by external order ID (required only if your integration sends orderExternalId) | POST /v1/void with orderExternalId set to your merchant orderId, no FlexFactor orderId, amount 4000, and a new idempotencyKey on a new order | HTTP 200; success true; GET returns the same status as before the void and payableAmount 59.00 | orderId, response |
10. Refund
Applies to: CORE. POST /v1/refund names the order in the request body, by the FlexFactor orderId or by your own order ID in orderExternalId. amount is in cents, the same as /capture and /void. The path-based POST /v1/orders/{id}/refund remains available and also accepts the deprecated amountToRefund field (dollars). If your integration still calls the path-based endpoint, run REFUND-01 to REFUND-06 against that endpoint, with the order ID in the URL. REFUND-07 is required only if your integration sends amountToRefund to the path-based endpoint; otherwise mark it Not applicable. POST /v1/refund requires amount and idempotencyKey on every request: send a new key for each refund and reuse it only on retries. On the path-based endpoint the key is optional, and this guide requires it there too. FlexFactor refunds the cardholder directly and adjusts merchant settlement, so a refund on a rescued order must call /refund and must not go to the original processor.
The response status is the refund outcome: SUCCESS or FAILED. result is always null on this endpoint. A failed refund normally returns HTTP 200 with status FAILED and success false. A refunded order stays at status completed; GET /v1/orders/{id} reports the refunded total in refundsAmount, in dollars, and order.refunded carries EventData.Amount in cents. The order.refunded checks and the webhook evidence in these cases apply when WEBHOOKS is In. When WEBHOOKS is Out, confirm each refund with refundsAmount from GET /v1/orders/{id}.
Reference: /refund, /refund HTTP status codes, Workflows §2.7, Appendix A.4.
| ID | Scenario | Setup / action | Expected result | Evidence |
|---|---|---|---|---|
| REFUND-01 | Full refund | POST /v1/refund with the FlexFactor orderId, amount 9900, and a new idempotencyKey on a Completed 9900-cent order | HTTP 200; status SUCCESS; success true; transactionId present; order.refunded received with Amount 9900; GET returns status completed and refundsAmount 99.00 | orderId, webhook IdempotencyKey |
| REFUND-02 | Full refund duplicate with a new key | Repeat REFUND-01 on the same order with a new idempotencyKey | The refund is rejected: HTTP 400, or HTTP 200 with status FAILED. No second credit; refundsAmount stays 99.00; one order.refunded event in total | Response, order record, webhook count |
| REFUND-03 | Partial refund | amount 2500 with idempotencyKey K1 on a new Completed 9900-cent order | HTTP 200; status SUCCESS; order.refunded with Amount 2500; GET returns status completed and refundsAmount 25.00 | orderId |
| REFUND-04 | Partial refund retry with the same key | Repeat REFUND-03 with K1 | HTTP 200; the original response is replayed; refundsAmount stays 25.00 | Both responses |
| REFUND-05 | Second distinct partial refund | amount 2500 with a new key K2 on the REFUND-03 order | HTTP 200; refundsAmount 50.00; a second order.refunded event | Order record, webhook IdempotencyKey |
| REFUND-06 | Refund above the remaining balance | amount 6000 on the REFUND-05 order (4900 cents remain) | HTTP 400; refundsAmount stays 50.00 | traceId |
| REFUND-07 | Partial refund with the deprecated amountToRefund field (required only if your integration sends amountToRefund) | POST /v1/orders/{orderId}/refund with amountToRefund 25.00, a new idempotencyKey, and no amount field, on a new Completed 9900-cent order | HTTP 200; status SUCCESS; order.refunded with Amount 2500; GET returns status completed and refundsAmount 25.00 | orderId |
Updated 8 days ago

