using Senparc.Weixin.Helpers; using Senparc.Weixin.TenPay; using Senparc.Weixin.TenPay.V3; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Web; using System.Web.Mvc;
namespace TestPay.Controllers { public class WeiXinController : Controller { private static TenPayV3Info _tenPayV3Info; public static TenPayV3Info TenPayV3Info { get { if (_tenPayV3Info == null) {
// 商品描述 string body = "测试支付"; string openId = ""; var timeStamp = TenPayV3Util.GetTimestamp();//时间戳 var nonceStr = TenPayV3Util.GetNoncestr();
var price = total_amout == null ? 1 : int.Parse(total_amout) * 100;//注意微信支付单位为分所以要100 如果传1就是1分钱 传100就是1块钱 //var ip = Request.Params["REMOTE_ADDR"]; var xmlDataInfo = new TenPayV3UnifiedorderRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, body, Guid, price, Request.UserHostAddress, TenPayV3Info.TenPayV3Notify, TenPayV3Type.MWEB/*此处无论传什么,方法内部都会强制变为MWEB*/, openId, TenPayV3Info.Key, nonceStr);
var result = TenPayV3.Html5Order(xmlDataInfo);//调用统一订单接口 //JsSdkUiPackage jsPackage = new JsSdkUiPackage(TenPayV3Info.AppId, timeStamp, nonceStr,); var package = string.Format("prepay_id={0}", result.prepay_id);//预支付订单id
using Aop.Api; using Aop.Api.Domain; using Aop.Api.Request; using Aop.Api.Response; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Web; using System.Web.Mvc;
namespace TestPay.Controllers { public class AliPayController : Controller { // GET: AliPay