The key lag or delay seems like it's a setting in the keyboard settings/ipad keyboard settings itself. Witness the keyboard preference pane in mac os x. I wonder if it's a accessibility setting...
To rule out third party apps:
1. Launch the Notes app. Type. If the notes app does not have the issue, it is the specific third-party apps you are using. I notice that some apps do not support bluetooth keyboards. Normally, they don't type at all.
But who knows?
2. Look for something in setting that controls keyboard delay?
Shut down any "open" apps. (I know that multiple apps cannot run at the same time on the ipad, but humor me.) [Note: just replicating what apple sometimes has people try.]
Turn off wi-fi and cellular data. Test again.
If this works, some syncing or downloading activity is happening in the background and creating lag.
Given that entering the code works fine, I doubt the hardware or bluetooth connection is faulty.
Post back with results and we'll decide what to do.
P.S Have you tried pairing the keyboard to a computer? Does this work ok?