1. Thank you so much for not telling her the truth.

2. Thank you so much for not having told her the truth.
============
Which one is grammatical? Are both OK? Which one is commonly used?

The first sentence is grammatical and commonly used.

Thank you for your help.

Isn't #2 grammatical?

What about the following?
Which one is correct?

3. I heard that you had not told her the truth.

4. I heard that you didn't tell her the truth.

Sentence 2 is grammatical, but awkward. I can't think of any situation when this would be necessary.

Both 3 and 4 are correct. However, 4 is more commonly used.

Both of the sentences you provided are grammatically correct, and they convey similar meanings. However, there are slight differences in their usage.

1. "Thank you so much for not telling her the truth."

This sentence uses the present participle form (gerund) "telling" to express an action that did not occur in the past. It indicates gratitude for someone's decision not to disclose the truth.

2. "Thank you so much for not having told her the truth."

This sentence uses the present perfect tense with the auxiliary verb "having" before the past participle "told." It emphasizes that the action of not telling the truth preceded a certain point in the past. This construction adds a sense of completion to the action.

Both versions are commonly used in everyday conversation, but the first one ("Thank you so much for not telling her the truth") may be more frequently used due to its simplicity and ease of use.