当前位置:网站首页>Example: use C # Net to teach you how to develop wechat official account (19) -- use wechat payment to transfer to wechat fans' change accounts

Example: use C # Net to teach you how to develop wechat official account (19) -- use wechat payment to transfer to wechat fans' change accounts

2022-06-09 21:06:00 Chaos scar

There are many ways for official account to pay for wechat users , The most common ones are sending red envelopes and transferring money to change accounts , The last article explained in detail the process of using red packets , From the configuration in the official account , Configuration of wechat payment , And then to the concrete class implementation .

This chapter mainly explains how to transfer money to change , The specific classes have been given in the last article , So just the demo code .

One 、 Results,

 

 

Two 、 Demo source code

Front end source code :

<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="AccountTest.aspx.cs" Inherits="Jjlm.AccountTest" %>

<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<head id="Head1" runat="server">
    <title> Wechat payment transfer to change test </title>

</head>

<body style="background:#fff;">
<center>
<div style="width:95%;">
 <form id="form1" runat="server">
    </br>
	openid*:<asp:TextBox runat="server" id="tbxOpenid" Width="60%" Visible="true"></asp:TextBox></br></br>
	 Transfer amount *:<asp:TextBox runat="server" id="tbxNum" Width="60%"></asp:TextBox></br></br>
	 Transfer remarks *:<asp:TextBox runat="server" id="tbxRemark" Width="60%"></asp:TextBox></br></br>
	 Merchant name :<asp:TextBox runat="server" id="tbxShanghu" Width="60%"></asp:TextBox></br></br>
	 Transfer description :<asp:TextBox runat="server" id="tbxZhufu" Width="60%"></asp:TextBox></br></br>
	 Reason for transfer :<asp:TextBox runat="server" id="tbxReason" Width="60%"></asp:TextBox></br></br>
	<div style="margin-top: 10px;text-align: center;">
		<asp:Button ID="btnSendCommission" Runat="server" OnClick="Send" width="15%" Text=" Wechat payment is transferred to change "></asp:Button>
	</div>	

	<asp:Label runat="server" id="lbresult" Visible="true"/>

</form>
</div>
</center>

</body>
</html>

Back end source code :

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Xml;
using System.Text;
using System.Net;
using System.Drawing;
using System.Drawing.Imaging;
using QinMing.Config;
using QinMing.WeixinPayPayment;

namespace Jjlm
{
	public partial class AccountTest : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			if (!IsPostBack)
			{

			}
		}

		protected void Send(object sender, EventArgs e)
		{
			Random r = new Random();
			string ran1 = r.Next(1000, 9999).ToString();
			string out_trade_no = QinMingConfig.Weixin_MchId + DateTime.Now.ToString("yyyyMMddHHmmss") + ran1;
			
			QinMingWeixinPayPayment.TransferAccountOne(tbxShanghu.Text, tbxZhufu.Text, tbxOpenid.Text, tbxNum.Text, tbxReason.Text, tbxRemark.Text, out_trade_no);
			lbresult.Text = " Wechat payment has been transferred , Please remember to check ";
		}
	}
}

The demo code is simple , So no explanation .

原网站

版权声明
本文为[Chaos scar]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206092047252407.html