Doing something and paying for it are separate in time. This means that just because you did something does't mean you have paid for it. In fact, the use of the conditional suggests that you haven't yet paid for it (otherwise we would know you had done it, and we wouldn't need the "if").
So, many combinations are possible:
If you did it, you will pay for it.
If you had done it, you will pay for it.
If you do it, you will pay for it.
If you do it, you pay for it.
And so on. If you use the past-tense "did" (or "had done") then the offense would have occurred in the past.
If you lied in court, the judge will send you to jail.
If you use the present tense "do" then you are talking hypothetically about a possible future offense:
If you lie in court, the judge will send you to jail.
If you lie in court, the judge sends you to jail.
There are other possibilities. Suppose you want to say someone paid for an offense that you are not sure they actually did:
If you did it, you paid for it.
Or suppose you want to suggest that, since they didn't pay for it, they couldn't have done it:
If you had done it, you would have paid for it.
This is far from a complete list.