From de9120d1eb75f92a86d5cc83a265f23f4e5d5a6a Mon Sep 17 00:00:00 2001 From: marcusDenslow Date: Sat, 11 Apr 2026 19:10:06 +0200 Subject: [PATCH] fix: Caddyfile domain and Stripe webhook API version mismatch - Update Caddyfile from placeholder api.yourdomain.com to api.sshops.uk - Use ConstructEventWithOptions with IgnoreAPIVersionMismatch to handle Stripe account API version (2026-01-28.clover) vs stripe-go v78 (2024-04-10) Co-Authored-By: Claude Sonnet 4.6 --- Caddyfile | 2 +- api/handlers/webhook.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Caddyfile b/Caddyfile index ea14651..992c9d3 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,3 +1,3 @@ -api.yourdomain.com { +api.sshops.uk { reverse_proxy api:8080 } diff --git a/api/handlers/webhook.go b/api/handlers/webhook.go index a059ad5..c14f9eb 100644 --- a/api/handlers/webhook.go +++ b/api/handlers/webhook.go @@ -48,7 +48,10 @@ func (h *WebhookHandler) HandleStripe(w http.ResponseWriter, r *http.Request) { log.Println("WARNING: STRIPE_WEBHOOK_SECRET is not set; skipping signature verification") } else { sig := r.Header.Get("Stripe-Signature") - if _, err := webhook.ConstructEvent(body, sig, h.webhookSecret); err != nil { + if _, err := webhook.ConstructEventWithOptions(body, sig, h.webhookSecret, webhook.ConstructEventOptions{ + IgnoreAPIVersionMismatch: true, + }); err != nil { + log.Printf("[webhook] signature verification failed: %v", err) utils.RespondError(w, http.StatusUnauthorized, "INVALID_SIGNATURE", "webhook signature verification failed", nil) return }