直连商户分账主要用于商户将交易成功的资金,按照一定的周期,分账给其他方,可以是合作伙伴、员工、用户或者其他分润方。 使用场景举例
相信不少小伙伴都推荐过一些IT培训的课程,比如你推荐成功以后,你会收到一笔佣金,其实他们也是使用了微信的分账功能。 产品特点
代码集成 对于分账微信提供了不少接口,比如,添加分账接收方、删除分账接收方、请求单次分账、请求多次分账、完结分账等等,具体可以去查看官网文档。 这里需要注意的是,分账接口不再是MD5加密,而是使用了HMAC-SHA256加密。上一坨伪代码: /** * 绑定分账账号 * @param allocation * @param config */ public voidaddWx(Allocation allocation, WxPayConfig config){ try{ Stringkey = config.getApiKey; SortedMap< String, String> packageParams = newTreeMap<>; wxPayUtil.commonParams(packageParams,config); packageParams.put( "sign_type",SystemConstant.SIGN_HMAC); JSONObject receiver = newJSONObject; receiver.put( "type",allocation.getAccountType); receiver.put( "account",allocation.getAccount); receiver.put( "name",allocation.getName); receiver.put( "relation_type", RelationType.HEADQUARTER.getCode); packageParams.put( "receiver",receiver.toJSONString); Stringsign = PayCommonUtil.createSign(packageParams, key, SystemConstant.SIGN_HMAC); packageParams.put( "sign", sign); StringrequestXML = PayCommonUtil.getRequestXml(packageParams); StringresXml = HttpUtil.postData(WxPayUrl.PROFIT_SHARING_ADD_URL, requestXML); Mapmap = XMLUtil.doXMLParse(resXml); StringreturnCode = ( String) map.get( "return_code"); if(SystemConstant.SUCCESS.equalsIgnoreCase(returnCode)){ 充值微信红包![]() |
1
![]() 鲜花 |
1
![]() 握手 |
![]() 雷人 |
![]() 路过 |
![]() 鸡蛋 |
业界动态|佰企网
2025-04-27
2025-04-27
2025-04-27
2025-04-27
2025-04-27
请发表评论