add function purchase