Using the value of the redemptions array provided when redeeming a voucher or part of a voucher, you can reverse this redemption in the event of a void or refund of that voucher redemption or transaction.
POST REQUEST (/redeem/reverse)
Header: Content-Type application/json
Header: Accept application/json
Header: Smart-Auth sk_XXXXXXXXXXXXXXXXXX
You can find the site number you should submit along with this request in the company configuration on the Smart Gift dashboard.
When you redeem a voucher, it will generate one or more transactions. In the case of simple monetary redemptions, this will be a single transaction, if you redeem several experience elements, each will get its own redemption record. These records are all reversible and can be reversed individually, a single transaction cannot be part-reversed though.
For the redemptions you should provide an array of redemption ID's as provided in the redemption step. Each redemption passed in will be fully reversed.
{
"voucher_no":"XXXXXXXXXX",
"site_id": "X",
"redemptions": [
21, 22, 23
]
}
{
"message": "Redemption reversal complete"
}
Errors will be displayed in the following format and will be returned along with a 422 http response code. In cases where a single field has multiple errors, it is most likely the case that the first message is the error you need to look out for.
If a voucher with the number you've provided does not exist, you will be returned the following response:
{
"message": "Sorry, that voucher number is invalid.",
"errors": {
"voucher_no": [
"Sorry, that voucher number is invalid."
]
}
}
If the site id you pass with your request does not belong to the company that the Smart-Auth header authenticates you as, you will be returned the below response:
{
"message": "This site number is invalid",
"errors": {
"site_id": [
"This site number is invalid"
]
}
}
If you include redemption ids that are not valid then you will receive the below request. This may occur if the id is incorrect or if you accidentally send the request twice (as the redemption has already been reversed)
{
"message": "One or more of the redemption ID's provided are invalid",
"errors": {
"redemptions": [
"One or more of the redemption ID's provided are invalid"
]
}
}
If you include redemption ids that are not valid then you will receive the below request. This may occur if the id is incorrect or if you accidentally send the request twice (as the redemption has already been reversed)
{
"message": "Please provide an array of redemptions to reverse",
"errors": {
"redemptions": [
"Please provide an array of redemptions to reverse"
]
}
}