Ignore Stripe API version mismatch in webhook

This commit is contained in:
Ian Gulliver
2025-12-30 11:52:52 -08:00
parent d499ae8767
commit 87ef0a5550
2 changed files with 10 additions and 2 deletions

View File

@@ -374,7 +374,7 @@ func handleStripeWebhook(w http.ResponseWriter, r *http.Request) {
return
}
event, err := webhook.ConstructEvent(body, r.Header.Get("Stripe-Signature"), os.Getenv("STRIPE_WEBHOOK_SECRET"))
event, err := webhook.ConstructEventWithOptions(body, r.Header.Get("Stripe-Signature"), os.Getenv("STRIPE_WEBHOOK_SECRET"), webhook.ConstructEventOptions{IgnoreAPIVersionMismatch: true})
if err != nil {
log.Println("[ERROR] failed to verify webhook:", err)
http.Error(w, "invalid signature", http.StatusBadRequest)