Step 1: To get started, add a Short Answer field to your form for the coupon code and a Number field for the total calculation.
Step 2: Add the Discount Code plugin by navigating to Settings > Plugins and clicking the Add button next to Discount Codes.
Step 3: In the settings, map the appropriate fields on your form, and set your discount codes. On your live form, the total field will change after someone enters the discount code and clicks Apply Code.
For more in-depth setup information, read this help article.