As tempting as it might be, no. I would never do this. Not only is there an issue about professional trust, but it's a vulnerability that you're deliberately building into a system.
I know that it's hard, but if you suspect that a client isn't going to pay you, don't do the job. There's no point in 1) doing the project and hoping (if they don't pay, then you're not only not getting that money, but you're losing time that you could have spent looking for more reliable clients), or 2) wasting time building in vulnerabilities and then charging the client for the privilege.
If you realise after you start a project that a client may not pay, talk to them about it (in writing/email), and either cut off the project then (once again, no point throwing more time at a bad client), or take them to court (even just small claims court).
^ Absolutely this. You'll entirely risk losing your professional reputation, how much work do you think you'll continue to get if people realise that you're not only building in a vulnerability but also willing to use it if the situation isn't 100% to you're liking!
Once you get the impression your invoice will go unpaid either take legal action like most 'civilised' people, or just take it on the chin and walk away (warning other developers off if you like...)!
I know that it's hard, but if you suspect that a client isn't going to pay you, don't do the job. There's no point in 1) doing the project and hoping (if they don't pay, then you're not only not getting that money, but you're losing time that you could have spent looking for more reliable clients), or 2) wasting time building in vulnerabilities and then charging the client for the privilege.
If you realise after you start a project that a client may not pay, talk to them about it (in writing/email), and either cut off the project then (once again, no point throwing more time at a bad client), or take them to court (even just small claims court).