I want to implement a bitcoin payment gateway without the help of any third party. So the idea is that I give the public address to the users and check the balance of the address using any API.
But there is a problem, how can I know which user sent how much money to the address. For example, I give 2 users my public address. They both bought the same thing. One paid the money and the other did not. How can I detect which user paid the money?
I guess generating a new address for every order is not a good idea.
I guess generating a new address for every order is not a good idea.
It is actually the best idea, and how it is implemented everywhere else. You should create a new address for every single transaction. BIP32 details a method used by most wallets to create many addresses from a single master key.