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`.
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
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
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 voucherstatus- status given to the voucher after proper activation. StatusUSEDis the only status we should see on a proper activation.detail- shows us the error description- SUCCESS CODE is 200
- ERROR CODE is 404
{
"price":27.0,
"status":"USED"
}
{
"detail":"Voucher not found"
}
{
"detail":"Partner not found"
}
{
"detail":"Method Not Allowed"
}