Skip to content

微信小程序虚拟支付订单查询响应新增结算及手续费字段#3914

Merged
binarywang merged 5 commits intodevelopfrom
copilot/add-fee-related-fields
Mar 10, 2026
Merged

微信小程序虚拟支付订单查询响应新增结算及手续费字段#3914
binarywang merged 5 commits intodevelopfrom
copilot/add-fee-related-fields

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

WxMaXPayQueryOrderResponse.OrderInfo 缺少微信文档中定义的结算状态与手续费相关字段。

新增字段(OrderInfo

Java 字段 JSON 键 类型 说明
channelOrderId channel_order_id String 渠道单号(微信支付详情页商户单号)
wxpayOrderId wxpay_order_id String 微信支付交易单号
settTime sett_time Long 结算时间秒级时间戳,大于0表示结算成功
settState sett_state Integer 结算状态:0-未开始 1-结算中 2-成功 3-待结算
platformFeeFen platform_fee_fen Long 虚拟支付技术服务费(分),settState=2 时返回
cpsFeeFen cps_fee_fen Long CPS 服务费(分),settState=2 时返回

settTimeplatformFeeFencpsFeeFen 均使用 Long 类型,与类中其他时间戳和金额字段保持一致,避免 2038 年问题及大额金额溢出风险。

所有新增字段均采用 Javadoc /** */ 格式注释。

参考:微信虚拟支付文档 - query-order

Original prompt

This section details on the original issue you should resolve

<issue_title>微信小程序-虚拟支付-订单查询-响应字段 新增手续费金额相关字段</issue_title>
<issue_description>微信小程序-虚拟支付-订单查询-响应字段 新增了分账手续费等相关字段。

文件位置:

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/xpay/WxMaXPayQueryOrderResponse.java

微信开发文档:

https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/virtual-payment.html#query-order

新增的接口返回内容:

字段名 类型 含义
channel_order_id string 渠道单号,为用户微信支付详情页面上的商户单号
wxpay_order_id string 微信支付交易单号,为用户微信支付详情页面上的交易单号
sett_time int 结算时间的秒级时间戳,大于0表示结算成功
sett_state int 结算状态0-未开始结算 1-结算中 2-结算成功 3-待结算(与0相同)
platform_fee_fen int 虚拟支付技术服务费,单位为分;sett_state = 2时返回
cps_fee_fen int 公众号、视频号平台的cps服务费,单位为分;sett_state = 2时返回

另:询问调用此接口的Java文件在哪?

微信小程序服务端 -> 小程序登录 -> 检验登录态

https://developers.weixin.qq.com/miniprogram/dev/server/API/user-login/api_checksessionkey.html

GET https://api.weixin.qq.com/wxa/checksession?access_token=ACCESS_TOKEN

参数名 类型 必填 说明
openid string 用户唯一标识符
signature string 用户登录态签名,用session_key对空字符串签名得到的结果。即 signature = hmac_sha256(session_key, "")
sig_method string 用户登录态签名的哈希方法,目前只支持 hmac_sha256

添加后的文件内容:

WxMaXPayQueryOrderResponse.java

package cn.binarywang.wx.miniapp.bean.xpay;

import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaXPayQueryOrderResponse extends WxMaBaseResponse implements Serializable {
  private static final long serialVersionUID = 7495157056049312108L;
  @SerializedName("order")
  private OrderInfo order;

  public String toJson() {
    return WxMaGsonBuilder.create().toJson(this);
  }

  @Data
  public static class OrderInfo {
    @SerializedName("order_id")
    private String orderId;
    @SerializedName("create_time")
    private Long createTime;
    @SerializedName("update_time")
    private Long updateTime;
    @SerializedName("status")
    private Integer status;
    @SerializedName("biz_type")
    private Integer bizType;
    @SerializedName("order_fee")
    private Long orderFee;
    @SerializedName("coupon_fee")
    private Long couponFee;
    @SerializedName("paid_fee")
    private Long paidFee;
    @SerializedName("order_type")
    private Integer orderType;
    @SerializedName("refund_fee")
    private Long refundFee;
    @SerializedName("paid_time")
    private Long paidTime;//unix秒级时间戳
    @SerializedName("provide_time")
    private Long provideTime;
    @SerializedName("env_type")
    private Long envType;
    @SerializedName("biz_meta")
    private String bizMeta;
    @SerializedName("token")
    private String token;

    @SerializedName("leftFee")
    private Long leftFee; //支付单类型时表示此单经过退款还剩余的金额,单位分
    @SerializedName("wxOrderId")
    private String wxOrderId;

    @SerializedName("channel_order_id")
    private String channelOrderId; // 渠道单号,为用户微信支付详情页面上的商户单号
    @SerializedName("wxpay_order_id")
    private String wxpayOrderId; // 微信支付交易单号,为用户微信支付详情页面上的交易单号
    @SerializedName("sett_time")
    private Integer settTime; // 结算时间的秒级时间戳,大于0表示结算成功
    @SerializedName("sett_state")
    private Integer settState; // 结算状态0-未开始结算 1-结算中 2-结算成功 3-待结算(与0相同)
    @SerializedName("platform_fee_fen")
    private Integer platformFeeFen; // 虚拟支付技术服务费,单位为分;sett_state = 2时返回
    @SerializedName("cps_fee_fen")
    private Integer cpsFeeFen; // 公众号、视频号平台的cps服务费,单位为分;sett_state = 2时返回
  }
}

</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: 全部用中文
需要用中文,包括PR标题和分析总结过程


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…mFeeFen、cpsFeeFen

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot AI changed the title [WIP] Add fee-related fields to order query response 微信小程序虚拟支付订单查询响应新增结算及手续费字段 Mar 9, 2026
@binarywang binarywang marked this pull request as ready for review March 10, 2026 02:31
Copilot AI review requested due to automatic review settings March 10, 2026 02:31
@augmentcode
Copy link

augmentcode bot commented Mar 10, 2026

🤖 Augment PR Summary

Summary: 本 PR 为微信小程序虚拟支付“订单查询”响应补齐微信文档新增的结算状态与手续费相关字段。

Changes:WxMaXPayQueryOrderResponse.OrderInfo 中新增渠道单号、微信支付交易单号、结算时间/状态,以及平台技术服务费与 CPS 服务费(分)字段,确保能完整反序列化接口返回。

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本 PR 针对微信小程序虚拟支付「订单查询」接口的响应模型补齐微信文档新增的结算状态与手续费相关字段,确保 WxMaXPayQueryOrderResponse.OrderInfo 能完整承载最新返回数据。

Changes:

  • OrderInfo 中新增渠道单号/微信支付交易单号字段(channelOrderIdwxpayOrderId
  • 新增结算时间与结算状态字段(settTimesettState
  • 新增平台技术服务费与 CPS 服务费字段(platformFeeFencpsFeeFen

binarywang and others added 2 commits March 10, 2026 10:36
…n/xpay/WxMaXPayQueryOrderResponse.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n/xpay/WxMaXPayQueryOrderResponse.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@binarywang
Copy link
Owner

@copilot 请使用javadoc的方式添加注释,不要使用双斜杠的方式注释字段

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 10, 2026

@copilot 请使用javadoc的方式添加注释,不要使用双斜杠的方式注释字段

已在 9974e09 将新增字段的注释全部改为 Javadoc /** */ 格式。

@binarywang binarywang merged commit a9747e5 into develop Mar 10, 2026
1 check passed
@binarywang binarywang deleted the copilot/add-fee-related-fields branch March 10, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

微信小程序-虚拟支付-订单查询-响应字段 新增手续费金额相关字段

3 participants