He has to apologize in public that he has sinned against God, and against heaven.
King David did just that, and God put away his sins which were many ranging from outright lies, adultery, murder and an attempt to sweep that ignominy under the carpet.