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 <noreply@anthropic.com>
This commit is contained in:
2026-04-11 19:10:06 +02:00
parent 77a044e11d
commit de9120d1eb
2 changed files with 5 additions and 2 deletions

View File

@@ -1,3 +1,3 @@
api.yourdomain.com {
api.sshops.uk {
reverse_proxy api:8080
}

View File

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