The legal term is solicitation of prostitution, and the person is often referred to as a sex buyer. Informally, they are known as a "john" or "trick". In other contexts, terms like whoremaster or whoremonger may also be used.
Legal terminology
Solicitation of prostitution: This is the act of requesting, offering, or agreeing to engage in sexual conduct for a fee.
Sex buyer: This term is increasingly used, particularly in jurisdictions that focus on the purchaser as the perpetrator of the crime.
Informal or slang terms
John: This is a very common slang term for a customer of a prostitute. It is believed to have originated because customers would give "John Smith" as a fake name to law enforcement to remain anonymous.
Trick: This is another informal term used, often by prostitutes and law enforcement, for a customer.
Punter: This is the equivalent of "john" in British and Irish slang.
Whoremaster / Whoremonger: These are older terms that can refer to a customer, but can also refer to a pimp or procurer.
Kerb crawler: This is a slang term, particularly in the UK, for someone who drives around looking for prostitutes.