Example #1
0
        private static PrePayMessage PreWXPayByNewAccessToken(string postData)
        {
            var           accessToken = AccessToken.NewInstance();
            string        url         = string.Format(WeiXinConst.WeiXin_Pay_PrePayUrl, accessToken.Access_Token);
            PrePayMessage result      = HttpClientHelper.PostResponse <PrePayMessage>(url, postData);

            return(result);
        }
Example #2
0
        /// <summary>
        /// 生成预支付订单
        /// </summary>
        /// <param name="postData">请求参数</param>
        /// <returns></returns>
        public static PrePayMessage PreWXPay(string postData)
        {
            var           accessToken = AccessToken.Instance;
            string        url         = string.Format(WeiXinConst.WeiXin_Pay_PrePayUrl, accessToken.Access_Token);
            PrePayMessage result      = HttpClientHelper.PostResponse <PrePayMessage>(url, postData);

            if (result.TokenExpired)
            {
                return(PreWXPayByNewAccessToken(postData));
            }

            return(result);
        }