implement purchase endpoint on server