If she directly threatened to make it public unless he paid her, then that's blackmail.
The way these things are usually worked out is that the woman shops her story around to tabloids in a manner so that the target will learn of it. Then the tabloid buys the exclusive rights to the story and it becomes an intellectual property deal and the tabloid then works it out with the target (like selling the rights to them). That's how they usually avoid blackmail law.
That's how Trump did it with another woman, Karen McDougal. (Maybe that's where the whole "Karen" meme started?)
A similar thing happened to David Letterman a couple of decades ago. A boyfriend of his mistress wrote a screenplay about a famous TV personality who had a mistress that exactly paralleled Letterman's situation. He then tried to sell the screenplay directly to Letterman.
Letterman turned the guy into the cops rather than paying the blackmail money and the story was made public.
@Pat @freemo it’s because they violated campaign finance law, which Cohen went to jail for. Even if she did blackmail him, they would still be guilty of that.