I want to make it customizable. However, I think at least 1 confirmation should be a requirement. But wait... is it even possible to detect a payment without any confirmations?
Yes it is possible in most cases to detect transactions as soon as they are sent to the network (that is how you can pay for things in less than 10 minutes with bitcoin).
What I would suggest is that you generate a master private key offline. You now have a private key P and a public key p.
With elliptic curve cryptography if you generate another private key Q with public key q. The public key formed by adding the private keys together will be equal to the public keys added together (in modular arithmetic). P+Q --> p+q
This means that you can use PHP to generate new public keys on the fly by setting Q = $payment.id
You can safely store p on the server (but never store P online) this means you can work out the public key the user has to pay to = p+q.
Now you can use a bitcoin api like
blockchain's to work out if a user has paid or not (and you can set how many confirmations)
You can use
this library to do the elliptic curve stuff (although you will have to add in the parameters for the secp256k1 curve).