The code to validate the promo code, calculate the discount, and deduct it from the sale price is usually integrated in the shopping cart software. If you ave something simple like payment by paypal it might be complicated to add such code (you probably need to describe your shopping cart system)
Be aware Promo Code entry boxes can cause losses of sales, when someone is on the payment page ready to give you their money, then they see the possibility of getting a discount so they leave to search the internet for the code. If your marketing methods cause most customers to come from coupon sites it may be OK.
A web search turns up a lot of people on forums and freelance programmer sites asking about promo code scripts.
This appears to be a free open source Paypal discount code
This appears to be one for sale: