Electron affinity is the tendency of a metal to accept electrons. In a general battery, one terminal has a higher electron affinity than the other, which attracts more electrons towards it, as compared to the other terminal. This potential difference between terminals create the voltage of the battery.