Involved in the biosynthesis of caffeine (By similarity). Catalyzes the conversion of 7-methylxanthine (7mX) to theobromine and of paraxanthine to caffeine (By similarity). 7-methylxanthine + S-adenosyl-L-methionine = H(+) + S-adenosyl-L-homocysteine + theobromine Binds 1 Mg(2+) ion per subunit. Alkaloid biosynthesis. Mainly expressed, at low levels, in leaves and fruits (grains) (PubMed:25249475, PubMed:25190796). Also present, at lower levels, in roots, stamens and pistils (PubMed:25190796). In leaves, mostly expressed in young tissues (PubMed:25249475). In fruits, mostly expressed in green grains but fades out as they are yellowing to disappear in red mature grains (PubMed:25249475, PubMed:25190796). Belongs to the methyltransferase superfamily. Type-7 methyltransferase family.