well - just a search for 'gift cards' in the wordpress plugins yields:
https://wordpress.org/plugins/search/gift+cards/
may be thats the kind of thing you are looking for (basically mostly suited for Woocommerce)? else its possible to develop something of course but this is much more effort - and would require more information about setup and such. Just to give you a simplyfied example for the principle that would need to be implemented with a promocode:
1. generating a code - relativly simple
2. the generated code would need to be stored in your database somewhere - because you want to at least be able to check if the code was only used once or how many times you want it to be used. after that the code should be invalid.
3. depending on how your shop works - your checkout form would need to have a field/line or however it should be handled (may be even as an additional product or such in the cart) to type in a code and the system would need to handle it accordingly for calculation or such.
i really cant think of a solution that wouldnt involve some backend here for a useful usecase - that means its not only HTML/CSS/Javascript - since that is only used clientside, while the purpose of promo codes/Gift cards is to be handled at the serverside for calculations and whatnot. So if you have a Woocommerce solution then a prebuilt plugin is probably the easiest option to go with.