先去看文档,看完之后我们来继续
https://opendocs.alipay.com/apis/api_28/alipay.fund.trans.uni.transfer/
准备工作
第一步,下载好证书,放在目录中
我用的config方式读取的
<add key="aliCertPublicKey" value="E:\\Project\\Cert\\alipayCertPublicKey_RSA2.crt" />
<add key="aliRootCert" value="E:\\Project\\Cert\\alipayRootCert.crt" />
<add key="aliAppCertPublicKey" value="E:\\Project\\Cert\\appCertPublicKey_202100.crt" />
<add key="aliEncyptKey" value="V1LKCQTBLg=="/>
第二步,添加SDK
第三步
CertParams cert = new CertParams();
cert.AlipayPublicCertPath = Configs.AppSettingsValue("aliCertPublicKey");
cert.AppCertPath = Configs.AppSettingsValue("aliAppCertPublicKey");
cert.RootCertPath = Configs.AppSettingsValue("aliRootCert");
IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", mShop.AppId, mShop.MerchantPrivateKey, "json", "1.0", "RSA2", "GBK", Configs.AppSettingsValue("aliEncyptKey"), cert);
AlipayFundTransUniTransferRequest request = new AlipayFundTransUniTransferRequest();
request.BizContent = "{" +
"\"out_biz_no\":\"" + with.BillCode + "\"," +
"\"trans_amount\":" + with.TransAmount + "," +
"\"biz_scene\":\"DIRECT_TRANSFER\"," +
"\"product_code\":\"TRANS_ACCOUNT_NO_PWD\"," +
"\"order_title\":\"主动提现:" + with.TransAmount + "元\"," +
"\"payee_info\":{" +
"\"identity\":\"" + with.AlipayAccount + "\"," +
"\"identity_type\":\"ALIPAY_LOGON_ID\"," +
"\"name\":\"" + with.AlipayName + "\"" +
"}}";
AlipayFundTransUniTransferResponse response = client.CertificateExecute(request);
if (response.Code == "10000")
{
json.msg = "提现成功,预计2小时内到账";
}
else
{
json.msg = "提现失败,请联系总部";
}
---------------------------------------------------------------------------------------------------------
转载请记得说明作者和出处哦-.-
作者:KingDuDu
原文出处:https://www.cnblogs.com/kingdudu/articles/12673474.html
---------------------------------------------------------------------------------------------------------
来源:oschina
链接:https://my.oschina.net/u/4312036/blog/4390468