What happens if you buy a elixir pack the get raided?

The amount you lose depends on your town hall level. The maximum you could lose is 20% if you are level 6 or lower.

enter image description here

Found here: https://clashofclans.fandom.com/wiki/Raids#Loot