Skip to content

微信支付在服务商模式下使用codepay接口时,会报缺少sub_mch_id参数错误 #3676

Description

@leideqin

简要描述

微信支付在服务商模式下使用codepay接口时,会报错。需要传入sub_mch_id参数。

模块版本情况

  • WxJava 模块名: weixin-java-pay
  • WxJava 版本号: 4.7.7-20250725.114118

详细描述

微信支付在服务商模式下使用codepay接口时,会报错。需要传入sub_mch_id参数。然而目前的WxPayCodepayResult请求类中,没有sub_mch_id相关的设置方法。

【请求地址】:https://api.mch.weixin.qq.com/v3/pay/transactions/codepay
【请求数据】:{"appid":"xxxxxx","mchid":"17085xxxxx","description":"订单支付","out_trade_no":"1234567890","payer":{"auth_code":"XXXXXXXXXXXXXX"},"amount":{"total":1},"scene_info":{"store_info":{"id":"1"}}}
【异常信息】:受理机构必须传入sub_mch_id
2025-08-14T19:09:16.423+08:00 ERROR 33440 --- [property-admin] [0.0-6002-exec-2] c.t.p.a.common.GlobalExceptionHandler    : 系统异常:

com.github.binarywang.wxpay.exception.WxPayException: 受理机构必须传入sub_mch_id
        at com.github.binarywang.wxpay.service.impl.WxPayServiceApacheHttpImpl.convertException(WxPayServiceApacheHttpImpl.java:346) ~[weixin-java-pay-4.7.7-20250725.114118.jar:na]
        at com.github.binarywang.wxpay.service.impl.WxPayServiceApacheHttpImpl.postV3WithWechatpaySerial(WxPayServiceApacheHttpImpl.java:159) ~[weixin-java-pay-4.7.7-20250725.114118.jar:na]        
        at com.github.binarywang.wxpay.service.impl.BaseWxPayServiceImpl.codepay(BaseWxPayServiceImpl.java:1156) ~[weixin-java-pay-4.7.7-20250725.114118.jar:na]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions