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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user