Don't charge user if coupon is applied

Hello, I am charging users using stripe, but I want to give some people access for free , looking for an example how could one do that.
I imagine there should be a database of coupons, and when user clicks the ‘buy’ button bubble would look up the the coupons database to see if there’s a correct entry and then either charge user if coupon is invalid or continue without charging