You must have opened a position with the company's instrument before the ex-dividend date and held it at its beginning. It isn't necessary to hold the position until the end of that date.
When are dividends paid?
CFD dividends will be paid into your account on the ex-dividend date. They are not dividends in the classical sense of the word. Their purpose is to adjust the downward price movement of the respective instrument that always occurs on its dividend ex-date.
Respectively, long positions receive a positive adjustment (funds being added), whereas short positions receive a negative one (funds being deducted).