/refund

Initiate full or partial refunds on orders that were charged through FlexFactor.





❗️

Prerequisites to invoke this API:

📘

Idempotency — full vs. partial refunds

Full refunds are de-duplicated server-side via the order ID: repeated full-refund calls for the same order will not double-credit, with or without a key.

Partial refunds are not auto-deduplicated. Because multiple distinct partial refunds against one order are legitimate, the order-ID guard cannot tell a retry apart from an intentional second partial refund. Send an idempotencyKey (a GUID, in the JSON body) on every partial refund and reuse it on retries — within the 24-hour replay window FlexFactor returns the original response instead of issuing a second partial credit, and a reused key carrying a different payload is rejected as a 409 conflict. See the Idempotency reference (§3.4) for the full replay-window, response-code, and retry behavior.


Request

Details

HTTP MethodPOST
Endpoint - Sandboxhttps://api-sandbox.flexfactor.io/v1/orders/{id}/refund
Endpoint - Productionhttps://api.flexfactor.io/v1/orders/{id}/refund
{id}FlexFactor unique transaction identifier.\ This is the orderSessionKey returned by /evaluate and/or /outcome and/or webhook and/or batch response file.

Body

amountToRefundDecimalRequiredIn dollars E.g.: '19.99'
refundMessageStringOptionalAdditional message you want to send with the request. E.g.: "Customer request"
idempotencyKeyGuidOptional — recommended for partial refundsFull refunds are de-duplicated server-side by order ID; partial refunds are not. Send a GUID here and reuse it on retries to prevent duplicate partial refunds — it replays the original response within the 24h window and detects reused-key conflicts. See Idempotency.


Try it right now:


Response

statusstringsuccess / fail
successbooleanIndicates if the API request was successful
resultstringThe result of the API request Optional
statusCodestringThe status code of the API request Optional
errorsarray of stringAny errors encountered during the API request Optional
customPropertiesobjectAdditional custom properties for the API request Optional

Updating the status order

After receiving a successful response from /refund, 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}/refund //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 '
{
  
  "amountToRefund": 12.00, //in dollars
 
}


Response


{
   "status": "SUCCESS | FAILED",
   "success": true,
   "result": null,
   "statusCode": null,
   "errors": [],
   "customProperties": {}
}