As a merchant, you're able to define a store-wide default commission rate as well as custom-define a rate for an individual affiliate. You can read more about those settings here.
Commissions are determined from your order subtotal minus discounts and excluding shipping and tax.
So, for an example, you have a product that's being sold as follows:
$100 product
20% discount
10% tax
$5 flat shipping
Let's assume you have a 5% commission rate on your store. A shopper then purchases this product via an affiliate link.
The shopper's total will be $93:
$80 ($100 product minus 20% discount)
$8 for tax (10% tax)
$5 shipping
Your affiliate will be owed $4 (5% x $80 = $4), based on the price of the product, less discount and not including tax and shipping.
Related: