If you purchase $1000 of goods having a trade discount of 20%, you can debit Purchases (periodic system) or Inventory (perpetual system) for $800 and Accounts Payable for $800. This is consistent with the cost principle which means the cash or cash equivalent amount.
If the invoice allows a 1% discount for paying within 10 days, you can record the 1% discount when you make payment within the allotted time. The entry for paying within 10 days would be: debit Accounts Payable $800, credit Cash for $792, and credit Purchase Discounts $8 (or Inventory $8 if perpetual).
If you are certain to always pay vendor invoices within their discount periods, you could initially record the above invoice at $792 (instead of $800). Debit Purchases or Inventory for $792 and credit Accounts Payable $792. When paying the invoice within the discount period, the entry would be a debit to Accounts Payable for $792 and a credit to Cash for $792. If you fail to pay the invoice within the discount period, the payment will have to be $800 and will be recorded with a debit to Accounts Payable $792, a debit to Purchase Discounts Lost $8, and a credit to Cash for $800. Purchase Discounts Lost is an income statement account.