add credit function