alipayconfig alipayconfig = new alipayconfig();
// 设置网关地址
string gateway = null;
alipayconfig.setserverurl(gateway);
// 设置第三方应用 appid
string app_id = null;
alipayconfig.setappid(app_id);
// 设置应用私钥
string private_key = null;
alipayconfig.setprivatekey(private_key);
// 设置应用公钥证书路径
string app_cert_path = null;
alipayconfig.setappcertpath(app_cert_path);
// 设置支付宝公钥证书路径
string alipay_cert_path = null;
alipayconfig.setalipaypubliccertpath(alipay_cert_path);
// 设置支付宝根证书路径
string alipay_root_cert_path = null;
alipayconfig.setrootcertpath(alipay_root_cert_path);
// 设置请求格式,固定值json
alipayconfig.setformat("json");
// 设置字符集
string charset = null;
alipayconfig.setcharset(charset);
// 设置签名类型
string sign_type = null;
alipayconfig.setsigntype(sign_type);
// 设置加密类型
alipayconfig.setencrypttype("aes");
// 设置 aes 密钥
string encryp_key = null;
alipayconfig.setencryptkey(encryp_key);
// 构造client
defaultalipayclient alipayclient = new defaultalipayclient(alipayconfig);