wechatpay-apiv3 / wechatpay-go

微信支付 APIv3 的官方 Go Library
https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/index.shtml
Apache License 2.0
1.07k stars 145 forks source link

退款回调按照issue写法 取不到解密后的数据 #204

Closed mingzaily closed 1 year ago

mingzaily commented 1 year ago
content := make(map[string]interface{})
notifyReq, err := handler.ParseNotifyRequest(context.Background(), request, content)
// 如果验签未通过,或者解密失败
if err != nil {
    fmt.Println(err)
    return
}
// 处理通知内容
fmt.Println(notifyReq.Summary)
fmt.Println(content)

content打印出来是空的

image image
mingzaily commented 1 year ago
// 退款回调
transaction := make(map[string]interface{})
notifyReq, err := handler.ParseNotifyRequest(ctx, r, &transaction)
if err != nil {
    common.Logger.Error(ctx, fmt.Sprintf("回调解析失败 Err=%v", err))
    return errcode.ThirdPartError.ReplaceMessage("回调解析失败")
}

可以了,大家可以参考我这样写