diff --git a/pkg/service/bundle/pay.go b/pkg/service/bundle/pay.go index 734ff62..8856fec 100644 --- a/pkg/service/bundle/pay.go +++ b/pkg/service/bundle/pay.go @@ -12,6 +12,7 @@ import ( "fonchain-fiee/pkg/service/bundle/common" bundleModel "fonchain-fiee/pkg/service/bundle/model" "io" + "math" "net/http" "strconv" @@ -52,7 +53,9 @@ func CreateStripeCheckoutSession(c *gin.Context) { fmt.Println("req.ProductAllPrice :", req.ProductAllPrice) //金额校验 - if detail.OrderRecord.TotalAmount*100 != float32(req.ProductAllPrice) { + orderAmountInCents := int64(math.Round(float64(detail.OrderRecord.TotalAmount * 100))) + reqAmountInCents := int64(math.Round(float64(req.ProductAllPrice))) + if orderAmountInCents != reqAmountInCents { service.Error(c, errors.New(common.InvalidOrderAmount)) return }