Redeem
/vouchers/redeem
Target audience: Developers
Introduction
This endpoint lets you redeem a voucher.
URI
Environment |
URI |
Stage |
https://payway-api.stage.adeprimo.se/external/api/v1/vouchers/redeem |
Production |
https://backend.worldoftulo.com/external/api/v1/vouchers/redeem |
Requirements
Identity |
Scope |
No |
/external/voucher/w |
Parameters
Field |
Required |
Type |
Description |
voucher_code |
Required |
String |
The package_code for which the voucher is valid. Size: 6 |
account_id |
Required |
String |
The id of the account to redeem the voucher for. Size range: ..24 Allowed values: "/^[a-f\d]{24}$/i" |
Curl Example
curl --request POST \
--url https://payway-api.stage.adeprimo.se/external/api/v1/vouchers/redeem \
--header 'accept: application/json' \
--header 'authorization: Bearer token' \
--header 'content-type: application/json' \
--data '{
:voucher_code => "123123",
:account_id => "585a4768edce2c5e6f000001"
}'
Response
Field |
Description |
id |
The id of the updated account. |
Example Response: Successfully redeemed voucher
HTTP 200
{
"item": {
"id": "585a4768edce2c5e6f000001"
}
}
Errors
Example error response
HTTP 409 Conflict
{
"code": "used",
"field": "unspecified_field",
"message": "voucher, is used and cannot be redeemed"
}
HTTP 400 Bad Request
Name |
Type |
Description |
invalid_parameter |
Object |
Validation error on any of the fields in the posted json |
json_parser_error |
Object |
The request body could not be parsed as valid json |
invalid_content_type_error |
Object |
The requests Content-Type header isn't set to application/json |
unknown_parameter |
Object |
One or more of the fields in the posted json was not recognized |
HTTP 404 Not Found
Name |
Type |
Description |
not_found |
Object |
The package could not be found |
HTTP 409 Conflict
Name |
Type |
Description |
used |
Object |
The voucher code is already redeemed |
does_not_exist |
Object |
The account does not exist |
HTTP 500 Internal Server Error
Name |
Type |
Description |
internal_server_error |
Object |
Something unexpected happened server side |