diff --git a/controller/stripe.go b/controller/stripe.go index afefd54b..e8d27d03 100644 --- a/controller/stripe.go +++ b/controller/stripe.go @@ -2,8 +2,8 @@ package controller import ( "github.com/gin-gonic/gin" - "github.com/stripe/stripe-go/v76" - "github.com/stripe/stripe-go/v76/webhook" + "github.com/stripe/stripe-go/v79" + "github.com/stripe/stripe-go/v79/webhook" "io" "log" "net/http" @@ -23,7 +23,9 @@ func StripeWebhook(c *gin.Context) { signature := c.GetHeader("Stripe-Signature") endpointSecret := common.StripeWebhookSecret - event, err := webhook.ConstructEvent(payload, signature, endpointSecret) + event, err := webhook.ConstructEventWithOptions(payload, signature, endpointSecret, webhook.ConstructEventOptions{ + IgnoreAPIVersionMismatch: true, + }) if err != nil { log.Printf("Stripe Webhook验签失败: %v\n", err) diff --git a/controller/topup.go b/controller/topup.go index 8ccc058f..a0d9f9cf 100644 --- a/controller/topup.go +++ b/controller/topup.go @@ -4,8 +4,8 @@ import "C" import ( "fmt" "github.com/gin-gonic/gin" - "github.com/stripe/stripe-go/v76" - "github.com/stripe/stripe-go/v76/checkout/session" + "github.com/stripe/stripe-go/v79" + "github.com/stripe/stripe-go/v79/checkout/session" "log" "one-api/common" "one-api/model" diff --git a/go.mod b/go.mod index a8ddec09..d4619b7d 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/pkoukk/tiktoken-go v0.1.7 github.com/samber/lo v1.39.0 github.com/shirou/gopsutil v3.21.11+incompatible - github.com/stripe/stripe-go/v76 v76.21.0 + github.com/stripe/stripe-go/v79 v79.12.0 golang.org/x/crypto v0.26.0 golang.org/x/image v0.15.0 golang.org/x/net v0.28.0 diff --git a/go.sum b/go.sum index 90efe27e..c9936fdc 100644 --- a/go.sum +++ b/go.sum @@ -176,8 +176,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/stripe/stripe-go/v76 v76.21.0 h1:O3GHImHS4oUI3qWMOClHN3zAQF5/oswS/NB7leV1fsU= -github.com/stripe/stripe-go/v76 v76.21.0/go.mod h1:rw1MxjlAKKcZ+3FOXgTHgwiOa2ya6CPq6ykpJ0Q6Po4= +github.com/stripe/stripe-go/v79 v79.12.0 h1:HQs/kxNEB3gYA7FnkSFkp0kSOeez0fsmCWev6SxftYs= +github.com/stripe/stripe-go/v79 v79.12.0/go.mod h1:cuH6X0zC8peY6f1AubHwgJ/fJSn2dh5pfiCr6CjyKVU= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=