Asp.Net Core3.0 微信转账到零钱
参考文档:
微信付款到零钱开发文档:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
用于向微信用户个人付款,目前支持向指定微信用户的openid付款。
1.付款转账
接口调用请求说明
请求url:https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers
是否需要证书:是(证书及使用说明详见 商户证书)
请求方式:POST
代码只是简单实现转账功能,仅供参考,请勿在生产环境使用,否则可能造成资金风险。
/// <summary>
/// 微信转账
/// </summary>
/// <param name="inputData"></param>
/// <param name="timeOut"></param>
/// <returns></returns>
public static WxPayData Transfers(WxPayData inputData, int timeOut = 6)
{
var url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"; inputData.SetValue("nonce_str", WxPayApi.GenerateNonceStr());//随机字符串
inputData.SetValue("sign", inputData.MakeSign());//签名
string xml = inputData.ToXml();
var start = DateTime.Now;
string response = HttpService.Post(xml, url, true, timeOut); var end = DateTime.Now;
int timeCost = (int)((end - start).TotalMilliseconds); WxPayData result = new WxPayData();
result.FromXml(response); ReportCostTime(url, timeCost, result);//测速上报 return result;
}
//转账
public class TransfersPay
{
public string openid { get; set; }
public int amount { get; set; }
public string partner_trade_no { get; set; }
public string re_user_name { get; set; }
public string spbill_create_ip { get; set; }
public WxPayData GetTransfersApiParameters()
{
WxPayData apiParam = new WxPayData();
apiParam.SetValue("mch_appid", _appid);//公众账号ID
apiParam.SetValue("mchid", _mchid);//商户号
apiParam.SetValue("partner_trade_no", partner_trade_no);
apiParam.SetValue("openid", openid);
apiParam.SetValue("check_name", "NO_CHECK");
apiParam.SetValue("amount", amount);
apiParam.SetValue("desc", "提现");
//apiParam.SetValue("spbill_create_ip", spbill_create_ip);
//apiParam.SetValue("re_user_name", re_user_name);
return apiParam;
}
}
Asp.Net Core3.0 微信转账到零钱的更多相关文章
- 2019年第一天——使用Visual Studio 2019 Preview创建第一个ASP.Net Core3.0的App
一.前言: 全文翻译自:https://www.talkingdotnet.com/creating-first-asp-net-core-3-0-app-visual-studio-2019/ Vi ...
- asp.net core3.0 mvc 用 autofac
好久没有写文章了,最近在用.net core3.0,一些开发中问题顺便记录: 1.首先nuget引入 Autofac Autofac.Extensions.DependencyInjection 2. ...
- asp.net 5.0微信支付
(原文出自:http://lib.csdn.net/article/wechat/46329) 微信支付官方坑太多,我们来精简 我把官方的代码,打包成了 an.wxapi.dll. 里面主要替换了下注 ...
- Postman 调试请求Asp.Net Core3.0 WebApi几种常见的Get/Post/Put/Delete请求
这里就直接截图了,如下(很简单的操作): 1:Get几种请求 2:Post 3:Put 4:Delete 最后,虽然简单,代码还是给放一下(这里只是抛砖引玉的作用,自己可以根据自身的业务需要来做进一 ...
- ASP.NET Core3.0 中的运行时编译
运行时编译 通过 Razor 文件的运行时编译补充生成时编译. 当 .cshtml 文件的内容发生更改时,ASP.NET Core MVC 将重新编译 Razor 文件 . 通过 Razor 文件的运 ...
- 如何使用Serilog.AspNetCore记录ASP.NET Core3.0的MVC属性
这是Serilog系列的第三篇文章. 第1部分-使用Serilog RequestLogging减少日志详细程度 第2部分-使用Serilog记录所选的终结点属性 第3部分-使用Serilog.Asp ...
- Asp.net Core3.0 跨域配置
原文:http://www.zilaohu.cn/Jie/Detail_Jie?ID=78840a04-55b8-4988-80b2-f964fd822d63 下面配置后:被拒绝的域请求后,可以进入方 ...
- 探索Asp net core3中的 项目文件、Program.cs和通用host(译)
引言 原文地址 在这篇博客中我将探索一些关于Asp.net core 3.0应用的基础功能--.csproj 项目文件和Program源文件.我将会描述他们从asp.net core 2.X在默认模版 ...
- 微信支付更新功能,商户转账到零钱 php版 (2022-10-12更新)
<?php class WechatMerchantTransfer { /** * @notes 商家转账到零钱 * @param $batch_no //提现订单号 * @param $le ...
- PHP实现微信提现V3版本2022-5更新接口:商家转账到零钱
微信官方又更新了接口... V3版本的微信商家转账到零钱的接口---俗称提现接口 注意事项 一:开通条件:需满足入驻满90天,连续正常交易30天,保持正常健康交易.二:分为页面发起和api接口操作,均 ...
随机推荐
- Vim之PHP语法检查
在Linux下操作,一般都是使用vim进行文本编辑, 这个时候有可能不小心就会出现语法异常,导致程序错误 手动检查: 1) 编辑完成之后, 回到命令行下执行 php -l test.php 如果语法校 ...
- linux 软连接使用
转载请注明出处: 在Linux系统中,软连接(Symbolic Link)是一种特殊类型的文件链接,类似于Windows系统中的快捷方式.它允许用户通过一个文件路径访问另一个文件或目录,而不需要拥有原 ...
- Linx操作Nginx命令
在 CentOS 上操作 Nginx 包括安装.启动.停止.重新加载配置等.以下是在 CentOS 上操作 Nginx 的常用命令: 安装 Nginx: sudo yum install nginx ...
- django admin 后台管理 新手学习步骤记录 (2)
学习使用django admin后台管理. 参考.Django基础之Admin后台数据管理_django admin_马航行的博客-CSDN博客
- Netty有关
https://www.baeldung.com/tag/netty/ https://github.com/eugenp/tutorials https://stackoverflow.com/qu ...
- SDK连接节点失败排查思路
https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/faq/connect.html Important: 前置说明 1 ...
- MyBatisPlus中updateById与updateAllColumnById方法区别
实现 updateById方法在插入时,会根据实体类的每个属性进行非空判断,只有非空的属性所对应的字段才会出现在SQL语句中. updateAllColumnById方法在插入时,不管属性是否为空,属 ...
- 记一次单元测试问题com.sun.crypto.provider.HmacSHA1 cannot be cast to javax.crypto.MacSpi
在用单元测试Junit测试部门的SDK时,有个md5鉴权步骤,出现了java.lang.ClassCastException: com.sun.crypto.provider.HmacSHA1 can ...
- 基于Three.js的大屏3D地图(一)
依赖安装 yarn add three yarn add @types/three yarn add d3-geo three库安装后在node_modules下其还包含核心three/src和插件t ...
- 主打一个“小巧灵动”:Vite + Svelte
作者:来自 vivo 互联网大前端团队- Wei Xing 在研发小型项目时,传统的 Vue.React 显得太"笨重".本文主要针对开发小型项目的场景,谈谈 Vite+Svel ...