Cancellation — the status becomes "Cancelled". Future commissions stop, but already paid-out commissions remain yours. The referral stays visible in your table for reference.
Refund — if Stripe reverses a payment within the 30-day waiting period, the corresponding commission is automatically withdrawn from your outstanding balance (so we don't pay out anything unfairly). Refunds after the waiting period are not reversed — that's partly why the waiting period exists.
In both cases you retain all previously paid commissions; only future earnings stop.