We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我使用新版沙箱做网页支付异步回调测试,支付成功后会成功回调,但是当我写死"fail",测试支付宝服务器重新发送回调请求却收不到
router.POST("/payment/handler/async", notifyHandler)
func notifyHandler(ctx *gin.Context) { // 从请求中解析通知内容 r := ctx.Request noti, err := alipay.ParseNotifyToBodyMap(r) if err != nil { xlog.Errorf("ParseNotifyToBodyMap error: %v", err) ctx.String(http.StatusBadRequest, "%s", "fail") //w.WriteHeader(http.StatusBadRequest) return }
// 验证通知是否来自支付宝 ok, err := alipay.VerifySignWithCert("./沙箱默认应用:2088721045264951/alipayPublicCert.crt", noti) if err != nil { xlog.Errorf("VerifySignWithCert error: %v", err) ctx.String(http.StatusBadRequest, "s", "fail") //w.WriteHeader(http.StatusBadRequest) return } if !ok { xlog.Error("Sign not matched") ctx.String(http.StatusBadRequest, "%s", "fail") //w.WriteHeader(http.StatusBadRequest) return } // 处理业务逻辑,例如更新订单状态 tradeStatus := noti.Get("trade_status") outTradeNo := noti.Get("out_trade_no") fmt.Println("交易状态:", tradeStatus) fmt.Println("订单号:", outTradeNo) // 返回给支付宝成功通知 ctx.String(http.StatusOK, "%s", "fail") //w.Write([]byte("success"))
}
The text was updated successfully, but these errors were encountered:
@xinhaohaohaohao 会不会支付宝沙箱就不支持重试呢?这个情况我没尝试过,条件不允许哎
Sorry, something went wrong.
No branches or pull requests
我使用新版沙箱做网页支付异步回调测试,支付成功后会成功回调,但是当我写死"fail",测试支付宝服务器重新发送回调请求却收不到
router.POST("/payment/handler/async", notifyHandler)
func notifyHandler(ctx *gin.Context) {
// 从请求中解析通知内容
r := ctx.Request
noti, err := alipay.ParseNotifyToBodyMap(r)
if err != nil {
xlog.Errorf("ParseNotifyToBodyMap error: %v", err)
ctx.String(http.StatusBadRequest, "%s", "fail")
//w.WriteHeader(http.StatusBadRequest)
return
}
}
The text was updated successfully, but these errors were encountered: