I wanted to ask is buying lottery ticket in Canada allowed in islam

A) It is not permissible for a Muslim to buy tickets of chance (including lottery), if he buys them with the intention of luckily winning the prize.

B) It is permissible for him to buy the lottery tickets if he buys it with the intention of participating in a charitable cause that is accepted Islamically like building hospitals, orphanages, etc., but not with the intention of winning the prize. However, this hypothetical situation is extremely difficult to occur in non-Muslim countries that consider certain activities that are forbidden in Islam to be of a charitable nature according to their own understanding.

In both the cases [of “a” and “b” if a Muslim wins the lottery], it is permissible to receive the prize from a non-Muslim [person or company].