That's gymnocalycium mihanovichii aka "Hibotan" or "moon cactus". That's the top, the bottom is dragonfruit.
These can live many years grafted and flower and fruit, mine do frequently.
Treat them like other cacti. Soil needs to be very well draining, I use miracle gro cactus soil with added extra perlite and tiny natural gravel, potted in a clay pot. They can handle full sun but be sure to rotate daily. During active months Water until you see it come out the bottom of the pot, when soil fully dries out then water again. If it's warm (55-60 F minimum night temp to be safe) they can stay outside but if it rains they only tolerate a day of rain and must be temporarily brought in as grafts are extra prone to rot. Outside in proper temps they grow better. During cool months (here is November to April) I don't water mine at all, they stay dormant, this triggers flowering come spring/summer. I fertilize monthly during May-October using liquid fertilizer and re pot once a year for new soil. The colors are from irradiation and also natural occurring mutants. I've cross bred natural forms with color ones and sometimes you get color ones which die if not grafted, or variegated individuals and then you could get green or purple seedlings that are natural color and grow on own roots, I currently am growing those.