Ask the pill name and color before purchasing and check the pill on
www.dancesafe.org
www.ecstasydata.com
www.pillreports.com

This is not 100% reliable because fakes of good pills can be made, they may have notable differences however. If the shape, logo, color and location match there is a good chance of it being from the same pill press.
MDMA also has a distinct bitter-metallic taste.