Skip to content

退款订单通知

提示

消息通知的接收和处理方式请参考回调和订阅消息接收

通知时机

当退款订单状态发生变化时,系统会主动将退款订单状态变化通知到商户的接收地址上。注意:发起退款时,出现退款失败时不会触发通知

支付状态描述是否通知
退款中退款中不会推送通知
退款成功退款成功后会推送通知
退款失败退款失败时会推送通知,但发起退款时返回的失败不会推送通知

注意事项

  1. 回调地址必须可被支付网关访问
  2. 回调地址仅支持http与https协议
  3. 如果要对回调消息验签,参照数据验签文档进行验签

通知参数

数据格式见回调和订阅消息接收, 业务数据格式与查询退款订单中的数据格式一致

通知示例

json

通知接收

可以使用SDK对接收到的通知内容进行反序列和验签,简化消息通知的处理流程。可以使用RefundNoticeModel退款通知实体类来接收数据,使用PaySignUtil进行验签

接收

java
package org.dromara.daxpay.single.demo.controller;

import cn.bootx.platform.common.core.annotation.IgnoreAuth;
import org.dromara.daxpay.single.sdk.model.notice.PayNoticeModel;
import org.dromara.daxpay.single.sdk.model.notice.RefundNoticeModel;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 *
 * @author xxm
 * @since 2024/2/24
 */
@Slf4j
@IgnoreAuth
@Tag(name = "回调测试")
@RestController
@RequestMapping("/demo/callback")
@RequiredArgsConstructor
public class ClientNoticeReceiveController {
    private final DaxPayDemoProperties daxPayDemoProperties;
   
      @Operation(summary = "退款消息")
    @PostMapping("/refund")
    public String refund(@RequestBody Map<String,Object> map) {
        log.info("接收到退款回调消息: {}",map);
        // 转换为对象
        RefundNoticeModel model = BeanUtil.toBean(map, RefundNoticeModel.class);
        log.info("验签结果: {}", PaySignUtil.hmacSha256Sign(model, daxPayDemoProperties.getSignSecret()));
        return "SUCCESS";
    }

    @Operation(summary = "退款消息(对象)")
    @PostMapping("/refundObject")
    public String refund(@RequestBody RefundNoticeModel model) {
        log.info("接收到退款回调消息: {}",model);
        log.info("验签结果: {}", PaySignUtil.hmacSha256Sign(model, daxPayDemoProperties.getSignSecret()));
        return "SUCCESS";
    }
}

验签

java
// MD5方式验签
PaySignUtil.verifyMd5Sign(model, "123456", model.getSign());
// HmacSha256方式验签
PaySignUtil.verifyHmacSha256Sign(model, "123456", model.getSign());
本文档内容版权属于济南易杯光年软件技术有限公司