As per the answer to this question, we cannot retrieve the public key of a user.
1)How does my wallet get the value (public key/public key hash) to which I need to make the payment?
2)What is the harm in exposing an address's public key?
I read through both questions, so please correct me if im answering the wrong question.
The user who you want to pay must send you their public key (or QR to scan) in order to send money to them. This is, of course, unless their public key (wallet) is listed on a public website. Please see https://en.bitcoin.it/wiki/Help:Introduction#Sending_payments
In general*, there is no harm in exposing a public key. This question on crypto stackexchange goes into more detail Is exposing a public key bad?
That person has to tell you what their public key (or its hash) is. A Bitcoin address is the most convenient way to encode the hash of a public key, so typically the person will tell you an address and ask you to make a payment to that address. You can enter that address into your wallet and make the payment.
If you are using
bitcoind, you can get new receivable address using
bitcore-cli getnewaddress command