Skip to content

Get Adjustment Code

Overview

This endpoint will return the adjustment codes that a given huggg can be redeemed against for the currently logged-in user's merchant. It is intended for use only by ePOS systems integrating with the huggg API.

GET /api/v2/hugggs/{id}/product/adjustment-codes

Request

The request's access token must be for a user that has permission to redeem hugggs on behalf of a specific merchant.

Url Parameters

Parameter Value Description
{id} String REQUIRED unique identifier for the huggg. This can either be the huggg Id or shortcode.

Examples

To request the adjustment codes that apply to a huggg with the ID abc123

HTTP GET /api/v2/hugggs/abc123/product/adjustment-codes
Authorization: Bearer abc123
Content-Type: application/json

Response

The response includes an array of strings, each of which are a merchant-defined adjustment code that the requested huggg is valid for redemption against. A huggg should redeem a single code from this list (that is, if the huggg returns an array of three strings, it is only valid against any one of those three, not against all three at once).

If there are no codes listed for the current merchant, the returned array will be empty.

The product_id field contains the API's internal identifier for the huggg's product.

Examples

HTTP/1.1 200 OK

{
    "data": {
        "product_id" : "abc123",
        "adjustment_codes": [ "one", "two", "three" ]
    }
}

If no valid Authorization header is provided, the response will be HTTP 401:

HTTP/1.1 401 Unauthorized

{
    "error": "Authentication failed."
}

If the huggg id or shortcode is invalid, the response will be HTTP 404:

HTTP/1.1 404 Not Found

{
    "error" : "huggg not found"
}

If the logged in user does not have permission to redeem for this huggg's merchant, HTTP 403 will be returned.

HTTP/1.1 403 Forbidden

{
    "error" : "Cannot redeem this huggg."
}

If the huggg has already been redeemed, HTTP 422 will be returned.

HTTP/1.1 422 Unprocessable Entity

{
    "error" : "huggg already redeemed."
}