Percentage or fixed amount off coupons are applied to charge line items before tax is calculated. Credits are their own line items on an invoice and are applied after coupons have discounted the charge line items.
Percentage and fixed amount off coupons are always applied to the next invoice after a coupon is redeemed. A coupon cannot retroactively discount an invoice. If you need to correct an existing invoice, you can issue a partial refund on the invoice equal to the discount amount, or you can do a full refund of the invoice, redeem the coupon and issue the invoice again with the correct discount.
Free trial coupon redemptions create a custom trial period when the subscription is created, so they expire as soon as the subscription is created. Since they don't provide a monetary discount, they are excluded from the first invoice and any future invoices.