Automating loyalty actions with on-pack codes