If one hires someone to do a service that is halachically forbidden, is he obligated/allowed to pay for it, e.g. blei gissen.
Tosfos (Bava Kama 71a, sv אילו [starts the page before]) writes
כיון שצריך לתת לה לצאת ידי שמים...חשיב אתנן ולא מתנה
Since he has to give it to her, in order to fulfil his Heavenly obligation...it is considered to be an "אתנן" (and therefore forbidden as a korban), and not a gift.
So payment for prostitution (a forbidden service, by all accounts) cannot be enforced by an earthly court, but is still obligatory לצאת ידי שמים.