Commerce – Void Return


Request Details

Item Value
Description This API is designed for the “post void” scenario at point of sale. The API deletes a return from the CrowdTwist commerce system and credits the points that were originally deducted by the return.
Method DELETE
Endpoint https://pos.crowdtwist.com/return/[return_id]
HTTP Header X-CT-Authorization = CTApiKey [ClientSecretKey]
Note: there is a space between CTApiKey and the Secret Key value


Request

Field Name Sample Value Required Format Notes
URL PARAMETERSnone
QUERY STRING PARAMETERSnone
HTTP HEADER
ClientSecretKey QWERTYUIOP Yes String  


Request

Field Name Sample Vaue Required Format Notes
return_id 123456 Yes String This is the unique id for the return.


Sample Request

Sample Successful Response – With User ID: Status Code 200
Whenever the request is successfully processed, a 200 Http Status code will be returned. This includes finding the original return, marking the return as “voided”, deleting the corresponding return history, and awarding points back to the user, if any.

{
  "return_id": 12345,
  "total_points_awarded": 1000,
  "user_id":123
}
{
  "return_id": 12345,
  "total_points_awarded": 1000,
  "user_id":123
}

Sample Successful Response – No User Id On Original Receipt: Status Code 200

When there is no user_id associated with the original return, we will calculate what the points would have been if there was a user_id. The user_id will be sent back with a null value.

{
  "return_id": 12345,
  "total_points_awarded": 1000,
  "user_id": null
}
{
  "return_id": 12345,
  "total_points_awarded": 1000,
  "user_id": null
}

Success Response Fields

name type description
return_id long This is the id of the return record in our system that matched the “return_id” in the request URL for the requesting client.
total_points_awarded long This is the total number of points awarded after the return is voided.
user_id long This will be null if there are no user id associated with the original return.

Sample Error Response: Status Code 400

Returned when the request URL is missing the return_id, or if the requested return does not exist.

{
  "error": {
    "system": "ReturnController",
    "reason": "return_not_found",
    "description": "Return not found.",
    "message": "Return ["return_id"] does not exist."
  }
}
{
  "error": {
    "system": "ReturnController",
    "reason": "return_not_found",
    "description": "Return not found.",
    "message": "Return ["return_id"] does not exist."
  }
}

Sample Error Response: Status Code 500

{
  "error": {
    "system": "ReturnController",
    "reason": "internal_error",
    "description": "Error trying to process request.",
    "message": "Client not configured."
  }
}
{
  "error": {
    "system": "ReturnController",
    "reason": "internal_error",
    "description": "Error trying to process request.",
    "message": "Client not configured."
  }
}


Error Response Codes

Error Error Code Description Reason
Input Error 4xx Returned whenever the request is missing required fields, including situations in which the body is malformed (e.g. HTTP method not supported, receipt not found, etc.). – missing_data
– not_supported
– return_not_found
– invalid
Server Error 5xx HTTP error status code is returned due to an error that occurred in the backend. – internal_error: unexpected error occurred in the CrowdTwist backend
– missing_field
– invalid_data
– not_configured: error occurs when an configuration has not been configured yet