This sound more like a use case for CloudPages Code Resource. Retrieving a content block using API will not result in executing the AMPscript within, as this only happens during Preview, Send or VAWP contexts.
You can use JSON code resource to execute the Ampscript, and print the output e.g. in this type of structure:
Your code should consist of two parts, one with logic claiming the voucher - receiving the contactKey, or other identificator of the person you assign the voucher to, from a request parameter.
And second part printing the output, e.g. like this:
Be mindful that these code resources reside at publicly available URLs, and are not secure. So you should take applicable precautions to prevent unauthorised execution of your Ampscript.