add purchase func