upgrade stripe

Signed-off-by: wozulong <>
This commit is contained in:
wozulong
2024-09-25 17:49:07 +08:00
parent 333849429b
commit 27b8495698
4 changed files with 10 additions and 8 deletions

View File

@@ -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)

View File

@@ -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"