Generally, a free confession to officers isn't immediately invalid, but its acceptance in court is a tricky matter. The key factor is whether it was obtained legally. Police must adhere to specific rules, including https://panchanandshaw.com/blog/court-fee-refund-explained/