Dafür is another one of those German contractions - in this instance, a combination of für + das. Its usage rules are like those for zum vs. zu dem, which we looked at a couple of months ago (https://members.rocketlanguages.com/members/forum/german-grammar/zu-vs-zum).
Essentially, the key rule to follow with any standard German contraction is this: If a contraction is possible, then it should be used. The only exceptions are when you are stressing the article or when the article is being used as a pronoun.
I hope that that is helpful!