Go to Settings > Sales Settings > Set up sales and select Payment Form from the left-hand menu.
Add a new field to the form and select “discount code” as the data type during configuration.
You can check "Activate discount codes at the Offer stage" to make the code entry field visible not only during the payment step, but also at the offer stage.
Once this is done, the section Settings > Sales Settings > Generate discount dodes will become available.
In this section, you can: