You receive commission as long as the referred customer remains active — no limit on duration. If an agency remains a customer for three years, you receive 30% (or 40% at super-affiliate tier) of their subscription every month for three years.
If the agency cancels, commissions stop from the next invoice period. With refunds, the corresponding commission is automatically reversed.