How does an electron 'know' if a photon was emitted by a positively or negatively charged particle I've always seen how electrons interact as being analogous to two particles passing a 'ball' between each other, thus exchanging momentum and repelling one and other.
This works for two particles of the same charge but doesn't for different ones.
Let's say we have some reasonably far-apart particles, an electron, and a positron.
The electron passes a photon to the positron, what happens is that the positron moves towards the electron, how does this work?
I would imagine that this 'ball' that was passed must've carried some information about where it came from, but then when I look up if photons emitted from positrons are the same as electrons, I see results saying that they are.
To put it in succinct terms:
Does the photon emitted by a charged particle carry any information about the charge of the object from which it originated?
 A: There is no real answer to your question, though legitimate because unfortunately it is based on a common misconception driven by pop science. All we can do is "debunk" this idea... Moreover, your last question is not clear because you do not explicitly say what kind of 'information' you think photons could carry apart from all their quantum numbers.

*

*Firstly, there is no exchange of virtual particles between two real particles. This is because, as I like to say, "virtual particles are mathematical artifacts from the perturbative expansion of the $S$ matrix we use." Roughly speaking, an $S$ matrix sends a "past infinity asymptotic state" to a "future infinity asymptotic state". We can write things like that:
\begin{equation}
|\psi(t\rightarrow \infty)\rangle = S|\psi(t\rightarrow -\infty) \rangle
\end{equation}
Then, since in QFT, we are interested in calculating the transition amplitudes, we project the state I've defined through the previous equation into another state, a final state arbitrarily chosen. So what is the probability amplitude for a state $|\psi_a \rangle$ to evolve into a state $|\psi_b\rangle$? The answer is:
\begin{equation}
A(|\psi_a\rangle \rightarrow |\psi_b\rangle)=\langle \psi_b | S | \psi_a \rangle
\end{equation}

*Now, since in QED, the coupling is small compared to 1, we can expand the $S$ matrix (which is just an exponential) like $S = \text{Id}-iT+\cdots$. And we define the $\mathcal{M}_{ba}$ matrix elements to be:
\begin{equation}
\mathcal{M}_{ba}=\langle \psi_b | iT | \psi_a \rangle
\end{equation}
These transition amplitudes give us the Feynman rules, namely the elementary blocks of Feynman diagrams. Thus, Feynman diagrams are mathematical tools representing transition amplitudes.

Going back to your question, you can see that I've never talked about virtual particles because these turn out to simply be internal lines of Feynman diagrams. Thus they are mathematical artifacts from the perturbative expansion of the $S$ matrix we use, as I said above.
Note that in general, we use the momentum representation, so our Feynman diagrams are nice products of algebraic quantities. But in position representations, they are convolutions, which is harder to deal with, taking into account the horrible expression for the propagators in position space (see here), even though it is much simpler for massless particles

Now, your question was along the line of "how come charged particles attract in one case and repel in the other case?". This is simply... The Coulomb Law. One can show that in position representation, our tree-level Feynman diagrams (diagrams not involving loops of propagators) for the $e^- e^+$ and $e^- e^-$ scattering reduce to the Coulomb Law$^{1}$ if we approximate the electron/positron field as having only two static Dirac delta-shaped particles$^{2}$. The higher-order diagrams contribute to the quantum corrections of the Coulomb law, making us able to derive such things as the Uehling potential for example.
In conclusion, your question is completely legitimate, and this is why it has been upvoted. But it is unfortunately based on a misconception, and as you can see from what I have written, things are much more complex than just "balls exchanged between particles". Instead, you have to see particle fields as interacting through what we call "gauge fields" (in our case, the photon field). And so the picture is not that different from the usual one of an electromagnetic field influenced by the presence of charged particles, except that in our case, we are able to compute quantum corrections.
[1] More precisely, you simply have to convolve your charge distribution with the propagator to find the photon field in the presence of this charge distribution, and then it is straightforward to find the potential energy associated with another charge distribution in this very photon field.
[2] Why static? Because then you are able to calculate the classical force between the particles and say that if you let them move, they will attract or repel.
A: The common YouTube passing the ball analogy for virtual photon exchange has done more harm than good. This is a common question that arises from the analogy that does really shed any light on scattering in QED, and encourages people to think of virtual particles in a far too classical context.
One way to look at it is to compare Bhabha scattering (electron-positron) and Moeller scattering (electron-electron) in the 1-photon exchange cross section. The scattering probability goes as an amplitude ($|-iM|$) squared, where Feynman diagrams are used to compute the amplitude. The amplitudes are proportion to the charge squared, so you don't even see the sign of the charge in the amplitude. Any difference comes in in the structure of the Dirac spinors (since anti-matter is different from matter).
I chose these reaction because their wikipedia pages shows their explicit calculations.
In Moller scattering you have:

where the photon has "mass" $t$. Since electrons are indistinguishable, there is a term with mass $u$:

They are added coherently and squared to get (in the relativistic limit) something that looks like:
$$ e^4\Big(\frac{s^2+u^2}{t^2} + \frac{s^2}{tu} +
\frac{s^2+t^2}{u^2}
\Big)$$
Meanwhile, in Bhabha scattering, there is an annihilation term:

which photon "mass" $s$, and a scattering term, again with $t$:

The probability goes like:
$$ e^4\Big(\frac{s^2+u^2}{t^2} + \frac{u^2}{st} +
\frac{s^2+t^2}{u^2}
\Big)$$
No sign of the sign of the charge, though there are remarkable symmetries in the formulae.
Regarding whether a virtual particle transmits information, they save answer is: No. One reason is $t < 0$ in the t-channel, meaning the exchanged photon in scattering is space like: the vertices cannot be time ordered. (Analogy: the basket ball is exchanged between the boats at faster than the speed of light....so it can't exchange information).
In the s-channel (annihilation), the photon is time-like but it seems to erase the information, where information means "charge and other quantum numbers that cancel between matter/anti matter pairs". Since it doesn't need to turn back into electron/positrons, it could be $q\bar q$ or $\mu^+\mu^-$..., that electron information is lost.
Basically: virtual particles bookkeep the energy, momentum, spin, charge, and other quantum numbers, in order to calculate a term in an infinite series approximation of the process.
In the
