最近应一个客户要求写了一段代码,要求从公众号的支付平台给用户发钱,我大体看了一下,这叫企业付款功能,由于客户的代码是asp写的,所以只能用asp来写接口了,这个功能还比较实用,可以片外支付从0.30元以上的钱付给用户,不说了,下面让代码:
微信公众号支付平台asp企业付款功能代码:
<% ‘作者微信:18611436777,转载请保留 set wxpay = New WxPayApi Dim Action,total_fee Action = Trim(Request.QueryString("action")) uid=request.QueryString("uid") oid=request.QueryString("oid") nickname=request.QueryString("nickname") If Action = "pay" Then openid = Trim(Request.form("openid")) total_fee = Trim(Request.form("total_fee")) Dim body,out_trade_no,attach body = "好生活俱乐部" partner_trade_no = wxpay.GetDateTime attach = "好生活"‘商户自定义数据包. wxpay.setParameter "appid","" wxpay.setParameter "mch_id","" wxpay.setParameter "mchid",MCHID wxpay.setParameter "mch_appid",APPID wxpay.setParameter "partner_trade_no",partner_trade_no wxpay.setParameter "check_name","NO_CHECK" wxpay.setParameter "amount",(total_fee)*100 wxpay.setParameter "spbill_create_ip","127.0.0.1" wxpay.setParameter "desc","好生活俱乐部奖励" wxpay.setParameter "openid",openid xml = wxpay.Get_company_pay() ‘wxpay.Die xml result = wxpay.Get_Xml_Text(xml,"//result_code") If result = "SUCCESS" Then ‘ wxpay.Die "付款成功!" ‘给VIP的数据库里pay+支付金额 cls.db.conn.execute("update [userinfo] set pay=pay+"&total_fee&" where uid="&uid) ‘把订单记录入paylist表:收入 bz="订单号:"&partner_trade_no&",支付给:"&nickname&total_fee&"元奖励" data=array(_ array("uid",uid,0,0,0),_ array("pay",total_fee,0,0,0),_ array("io","支",2,0),_ array("bz",bz,50,0)) Cls.db.dbnew "[paylist]",data,"" response.write "<script language=javascript>alert(‘"&bz&",打款成功!‘);window.location.href=‘../admin_viplist.asp‘;</script>" ‘response.Redirect "../admin/viplist.asp" Else wxpay.Die wxpay.Get_Xml_Text(xml,"//err_code_des") End If End If set wxpay = Nothing %> --------------------- 作者:码农18611436777 来源:CSDN 原文:https://blog.csdn.net/tocnc/article/details/89790371 版权声明:本文为博主原创文章,转载请附上博文链接!
原文地址:https://www.cnblogs.com/yjed/p/10843615.html
时间: 2024-11-11 21:36:36