Releasing A Voucher

There may be times when you need to release a voucher that has been held if you can not wait for the 5-minute lock to expire. To do this, you need to provide the hold token that was returned when the voucher was held.

Request

Headers

POST REQUEST (/redeem/release)

Header: Content-Type application/json
Header: Accept application/json
Header: Smart-Auth sk_XXXXXXXXXXXXXXXXXX

Body

For the body of this request, just supply the voucher_no of the voucher you wish to unlock and the hold_token that was returned when you locked it. If you do not have the hold token, you will have to wait until the voucher hold expires.

{
    "voucher_no": "12345678",
    "hold_token": "hold_token_xxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

Success Response

{
    "message": "Voucher hold released"
}

Error Responses

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.

Voucher is not held

If the voucher is not held, you will get a 422 response when trying to release it.

{
    "message": "Voucher is not held",
    "errors": {
        "hold_token": [
            "Voucher is not held"
        ]
    }
}


Invalid voucher number

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."
        ]
    }
}


Voucher does not belong to company

If a voucher number is provided that matches an existing voucher, but that voucher does not belong to the company that the Smart-Auth header authenticates, the response below will be shown. This response is rare outside of development but may occur for customers that have a group of companies (each with their own company in Smart Gift), as their end users may confuse the entities.

{
    "message": "This voucher does not belong to your company",
    "errors": {
        "voucher_no": [
            "This voucher does not belong to your company"
        ]
    }
}


Voucher has expired

Vouchers can be assigned optional expiry dates, the customer is able to set a start date and end date for voucher validity which will ultimately affect when the purchaser of the voucher is able to redeem it. If the current time does not fall between the start and end dates for the voucher's validity, the below message will be returned.

{
    "message": "The voucher number provided has expired.",
    "errors": {
        "voucher_no": [
            "The voucher number provided has expired."
        ]
    }
}


Voucher is fully redeemed

Finally, if a voucher is fully redeemed already, the response below will be returned. We do not currently expose a list of voucher transactions over the API, however the customer is able to see a full audit from within their dashboard.

{
    "message": "Sorry this voucher has already been redeemed.",
    "errors": {
        "voucher_no": [
            "Sorry this voucher has already been redeemed."
        ]
    }
}