The cost to avoid the penalty must be paid when the ability resolves. You can’t wait until later to do so.

Artwork
Loading artwork…
Heroism
Fallen Empires · #6 · EN
Nonfoil—Foil—
Card rules
Sacrifice a white creature: For each attacking red creature, prevent all combat damage that would be dealt by that creature this turn unless its controller pays 2
.
Uncommon · Illustrated by Mark Poole
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
Old School Legal
PreDH Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
Paying the Heroism cost to allow a creature to deal damage does not prevent other effects from preventing it from dealing damage. Paying the cost only prevents the Heroism effect.