fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat

微信支付v3支付功能都能用,但是用添加分账的功能返回 HTTP header缺少微信支付平台证书序列号(Wechatpay-Serial)"

Closed this issue · 1 comments

现在业务逻辑需要用到分账的功能。在使用添加分账的功能的时候返回

{"code":"PARAM_ERROR","message":"HTTP header缺少微信支付平台证书序列号(Wechatpay-Serial)"}

代码
`
var options = new WechatTenpayClientOptions();
options.MerchantId = pingTai.WX_ZF_Mchid;
options.MerchantV3Secret = pingTai.WX_ZF_APIV3_KEY;
options.MerchantCertificateSerialNumber = pingTai.WX_ZF_Cert_Serial_NO;
options.MerchantCertificatePrivateKey = pingTai.WX_ZF_Cert_Serial_PrivateKey;
options.PlatformCertificateManager = new InMemoryCertificateManager();

var wechatTenpayClient = WechatTenpayClientBuilder.Create(options).Build();

var req = new AddProfitSharingReceiverRequest()
{
AppId = pingTai.WX_XCX_APPID,
Type = "MERCHANT_ID",
Account = AppConfig.wxFenZhangConfig.MERCHANT_ID,
Name = AppConfig.wxFenZhangConfig.MERCHANT_NAME,
RelationType = "SERVICE_PROVIDER",

};

var response =await wechatTenpayClient.ExecuteAddProfitSharingReceiverAsync(req);

`

通过抓包得知在请求的时候头部缺少微信帮助文档中的Wechatpay-Serial
image

每个请求模型都有一个 WechatpayCertificateSerialNumber 属性是用来设置这个的。

另外建议先阅读文档里《如何加密请求中的敏感数据?》这一章。