The easiest way to avoid this scam is to not scan any unknown QR codes with your phone.