/// <summary> /// 获得预支付订单 /// </summary> /// <param name="e"></param> /// <param name="args"></param> private void OnPrePay(PrePay2Client e, object[] args) { if (e.storeName != StoreName.WX) { return; } Debug.LogWarning("OnPrePay=========:" + e.prepay_id + "=partnerId=="); DateTime dt1970 = new DateTime(1970, 1, 1, 0, 0, 0, 0); string nonceStr = "Random" + UnityEngine.Random.Range(10000, 99999).ToString(); string timeStamp = (new DateTime(DateTime.UtcNow.Ticks - dt1970.Ticks).AddHours(8).Ticks / 10000000).ToString(); string stringA = "appid=" + appid + "&" + "nonceStr=" + nonceStr + "&packageValue=Sign=WXPay&" + "partnerId=" + mchID + "&" + "prepayId=" + e.prepay_id + "&timeStamp=" + timeStamp; string stringSignTemp = stringA + "&key=" + appSecret; string sign = MD5Tool.GetMD5FromString(stringSignTemp); OnPayInfo onPayInfo = new OnPayInfo(); onPayInfo.isSuccess = true; onPayInfo.goodsId = e.goodsID; onPayInfo.storeName = StoreName.WX; onPayInfo.receipt = e.mch_orderID; onPayInfo.price = payInfo.price; onPayInfo.goodsName = payInfo.goodsName; PayReSend.Instance.AddPrePayID(onPayInfo); IndentListener(e.goodsID, e.mch_orderID, e.prepay_id, nonceStr, timeStamp, sign, payInfo.price); }
/// <summary> /// 获得预支付订单 /// </summary> /// <param name="e"></param> /// <param name="args"></param> private void OnPrePay(PrePay2Client e, object[] args) { WXListener.Instance.GetComponent <WXListener>().GoodId = e.goodsID; Debug.LogWarning("OnPrePay=========:" + e.prepay_id + "=partnerId=="); DateTime dt1970 = new DateTime(1970, 1, 1, 0, 0, 0, 0); string nonceStr = "Random" + UnityEngine.Random.Range(10000, 99999).ToString(); string timeStamp = (new DateTime(DateTime.UtcNow.Ticks - dt1970.Ticks).AddHours(8).Ticks / 10000000).ToString(); string stringA = "appid=wx3ce30b3054987098&" + "nonceStr=" + nonceStr + "&packageValue=Sign=WXPay&" + "partnerId=1526756671&" + "prepayId=" + e.prepay_id + "&timeStamp=" + timeStamp; string stringSignTemp = stringA + "&key=a8f73a2a5ecfafab1ea80515ef0efbad"; string sign = MD5Tool.GetMD5FromString(stringSignTemp); WXListener.Instance.GetComponent <WXListener>().Mch_orderID = e.mch_orderID; IndentListener(e.prepay_id, nonceStr, timeStamp, sign); }
/// <summary> /// 获得预支付订单 /// </summary> /// <param name="e"></param> /// <param name="args"></param> private void OnPrePay(PrePay2Client e, object[] args) { Debug.LogWarning("OnPrePay=========:" + e.prepay_id + "=partnerId=="); DateTime dt1970 = new DateTime(1970, 1, 1, 0, 0, 0, 0); string nonceStr = "Random" + UnityEngine.Random.Range(10000, 99999).ToString(); string timeStamp = (new DateTime(DateTime.UtcNow.Ticks - dt1970.Ticks).AddHours(8).Ticks / 10000000).ToString(); string stringA = "appid=wx3ce30b3054987098&" + "nonceStr=" + nonceStr + "&packageValue=Sign=WXPay&" + "partnerId=1526756671&" + "prepayId=" + e.prepay_id + "&timeStamp=" + timeStamp; string stringSignTemp = stringA + "&key=a8f73a2a5ecfafab1ea80515ef0efbad"; string sign = MD5Tool.GetMD5FromString(stringSignTemp); OnPayInfo onPayInfo = new OnPayInfo(); onPayInfo.isSuccess = true; onPayInfo.goodsId = e.goodsID; onPayInfo.storeName = StoreName.WX; //WXPayReSend.Instance.AddPrePayID(onPayInfo); IndentListener(e.prepay_id, nonceStr, timeStamp, sign); }