资源简介

本程序为支付宝线下扫码支付(含支付、查询、退款、二维码支付)。引用支付宝官网上DEMO中的两个DLL做成简易的WINFORM程序,供大家学习,少走弯路.
文件中包括WINFORM源码和支付宝官方DEMO。如需微信实例可在我上传的资源中下载。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.xml;
using Com.Alipay;
using System.Threading;
using Aop.Api;
using Aop.Api.Request;
using Aop.Api.Response;
using Com.Alipay.Domain;
using Com.Alipay.Model;
using Com.Alipay.Business;
using ThoughtWorks.QRCode.Codec;
using System.Security.Cryptography;
using System.Collections;

namespace alipay2005
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        string result = ““;
        IAlipayTradeService serviceClient = F2FBiz.CreateClientInstance(Config.serverUrl Config.appId Config.merchant_private_key Config.version
                           Config.sign_type Config.alipay_public_key Config.charset);
       
        //*********************************支付*******************************************************
        private void button1_Click(object sender EventArgs e)
        {
            AlipayTradePayContentBuilder builder = BuildPayContent();
            string out_trade_no = builder.out_trade_no;
            AlipayF2FPayResult payResult = serviceClient.tradePay(builder);

            switch (payResult.Status)
            {
                case ResultEnum.SUCCESS:
                    DoSuccessProcess(payResult);
                    break;
                case ResultEnum.FAILED:
                    DoFailedProcess(payResult);
                    break;
                case ResultEnum.UNKNOWN:
                    result = “网络异常,请检查网络配置后,更换外部订单号重试“;
                    MessageBox.Show(result);
                    break;
            }
        }
        private AlipayTradePayContentBuilder BuildPayContent()
        {
            //线上联调时,请输入真实的外部订单号。
            string out_trade_no = GuidTo16String();

            //扫码枪扫描到的用户手机钱包中的付款条码
            AlipayTradePayContentBuilder builder = new AlipayTradePayContentBuilder();

            builder.out_trade_no = out_trade_no;
            builder.scene = “bar_code“;
            builder.auth_code = textBox1.Text;
            builder.total_amount = “0.01“;
            builder.discountable_amount = “0.01“;
            builder.undiscountable_amount = “0“;
            builder.operator_id = “test“;
            builder.subject = “条码支付“;
            builder.timeout_express = “2m“;
            builder.body = “订单描述“;
            builder.store_id = “test store id“;    //很重要的参数,可以用作之后的营销     
            builder.seller_id = Config.pid;       //可以是具体的收款账号。
            

            //传入

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4755  2016-06-17 15:17  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\alipay2005.csproj

     文件       3632  2016-06-17 15:16  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\app_code\Config.cs

     文件       2455  2016-05-26 10:23  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\app_code\LogHelper.cs

     文件       7053  2016-06-16 11:39  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\app_code\WebSvcCaller.cs

     文件      32768  2016-06-17 15:18  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\alipay2005.exe

     文件      48640  2016-06-17 15:18  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\alipay2005.pdb

     文件       5632  2005-11-11 22:25  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\alipay2005.vshost.exe

     文件     832000  2016-03-22 17:46  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\AopSdk.dll

     文件    1953280  2016-03-22 17:46  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\AopSdk.pdb

     文件        276  2016-05-26 10:32  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\Demo\alipay_public_key.pem

     文件        269  2016-05-26 10:23  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\Demo\alipay_rsa_public_key.pem

     文件        887  2016-05-31 16:10  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\Demo\rsa_private_key.pem

     文件        887  2016-05-31 16:10  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\Demo\rsa_private_key1.pem

     文件        269  2016-05-26 10:23  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\Demo\rsa_public_key.pem

     文件      26624  2016-06-17 10:57  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\F2FPayDll.dll

     文件    6205440  2016-03-22 17:46  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\bin\Debug\ThoughtWorks.QRCode.dll

     文件        269  2016-05-26 10:23  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\Demo\alipay_rsa_public_key.pem

     文件        887  2016-05-31 16:10  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\Demo\rsa_private_key.pem

     文件        269  2016-05-26 10:23  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\Demo\rsa_public_key.pem

     文件      14289  2016-06-17 15:17  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\Form1.cs

     文件       9368  2016-06-17 15:17  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\Form1.Designer.cs

     文件       5814  2016-06-08 14:36  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\Form1.resx

     文件       6416  2016-06-17 15:23  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\obj\alipay2005.csproj.FileListAbsolute.txt

     文件        842  2016-06-08 17:08  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\obj\Debug\alipay2005.csproj.GenerateResource.Cache

     文件      32768  2016-06-17 15:18  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\obj\Debug\alipay2005.exe

     文件        180  2016-06-17 11:18  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\obj\Debug\alipay2005.Form1.resources

     文件      48640  2016-06-17 15:18  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\obj\Debug\alipay2005.pdb

     文件        180  2016-06-17 11:18  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\obj\Debug\alipay2005.Properties.Resources.resources

     文件      95708  2016-06-17 15:17  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\obj\Debug\ResolveAssemblyReference.cache

     文件        469  2016-05-26 10:22  支付宝线下支付C#2005WINFORM实例及官网DEMO\alipay2005Winform实例\alipay2005\Program.cs

............此处省略24个文件信息

评论

共有 条评论