Currency Gain/Loss

I understand currency gain/loss when there is a time difference between the invoice date and payment date and the rates move in the meantime.
But I’m getting some currency gain/loss on some Credit Card purchases, which ends up with the Credit Card account non-flat and generating p&l. Our purchases have been entered with USD amount and GBP amount and the invoice date should be the same with the payment date. So I believe a currency gain/loss should not be generated in that scenario. I believe HMRC accepts credit card rates and these rates will tend to be worse off than XE/London close rates.
Is the system generating gain/loss because of the difference between the rate calculated from the USD/GBP amount and the XE rate?
How do people keep the Credit Card account flat in that scenario?

Ok, I figure it out. The rate (defaulted to the XE rate) can be updated and needs to be updated too, to the implied rate from the GBP and the non-GBP amount. Then, it all triangulates, and no currency gain/loss is generated.
Although, given that the currency rate is stored up to 4 dps only, for some bigger amounts, there can be rounding errors, where the GBP amount doesn’t match the credit card amount. Would be good if the precision of the rate supported more dps.
Also, it’d be good to have that option “Match the invoice” that I’ve seen references to in previous posts here. +1 for that.

The invoice match facility is definitely something we’ll be looking into. Extending the ex-rate beyond 4 decimal places is not likely to be something we can look at in the near term. It would cause inconsistency issues with previously entered accounting data and would involve some very deep rooted changes to the way our system works.