Validate Activate

Voucher activation

The last step that will activate the voucher in the Voucher Star system. After this step the vouchers status is set to `USED`.

Validate the voucher before activating Voucher validation

How does this work?

After voucher validation we send it to the API to be activated. On voucher activation the voucher status will be set as USED and can be viewed in partners panel.

Requirements

  • $API_ACCESS_TOKEN - API access token - partners API access token that was provided with the activation Email
If you haven't got an API access token go back to Getting started

Activation endpoint

API domain

https://vouchstar.shop

API endpoint

/api/vouchers/activate/<voucher-code> - change <voucher-code> to the voucher code you want to activate.

eg.

  • our voucher code: 91f53b25-51be-41dd-afeb-18cf534d1d23
  • the full endpoint url should look like: /api/vouchers/activate/91f53b25-51be-41dd-afeb-18cf534d1d23
  • $FULL_API_ACTIVATION_URL - full url: https://vouchstar.shop/api/vouchers/activate/91f53b25-51be-41dd-afeb-18cf534d1d23

Request method

$HTTP_REQUEST_METHOD - Request method needs to be set as POST

Request header

$HTTP_REQUEST_HEADER - A custom Request header is needed: X-Access-Token

The API access token has been provided with the email invitation

Example

CURL will be used here to show you an example of working activation integration.

Parameters:

  • -X - define the request method
  • -H - define additional request headers

We will be using an additional header defined as -H 'accept: application/json'so that the data is requested as JSON

curl -X '$HTTP_REQUEST_METHOD' '$FULL_API_ACTIVATION_URL' -H 'accept: application/json' -H '$HTTP_REQUEST_HEADER'

Response codes

  • price - the value of the voucher
  • status - status given to the voucher after proper activation. Status USED is the only status we should see on a proper activation.
  • detail - shows us the error description
  • SUCCESS CODE is 200
  • ERROR CODE is 404
API successful response (200)
Code
{
    "price":27.0,
    "status":"USED"
}
API voucher not found response (404)
Code
{
    "detail":"Voucher not found"
}
API partner not found response (404)
Code
{
    "detail":"Partner not found"
}
API bad request method response (404)
Code
{
    "detail":"Method Not Allowed"
}

Copyright © 2024