Involved in the biosynthesis of caffeine. Catalyzes the conversion of 7-methylxanthine (7mX) to theobromine and with a lower activity of paraxanthine to caffeine (PubMed:12746542, PubMed:12527364, PubMed:18068204). Does not have 1-N-methylation activity (PubMed:12527364). 7-methylxanthine + S-adenosyl-L-methionine = H(+) + S-adenosyl-L-homocysteine + theobromine Binds 1 Mg(2+) ion per subunit. Optimum pH is 8. Alkaloid biosynthesis. Expressed, at low levels, in young leaves, floral buds and immature fruits (grains), but not in old leaves and mature fruits (PubMed:12746542, PubMed:25249475). Highly expressed in developing endosperm and flower buds (PubMed:12527364). Detected in young leaves (PubMed:12527364, PubMed:25249475). Belongs to the methyltransferase superfamily. Type-7 methyltransferase family.