mirror of
https://github.com/marcusDenslow/terminalShop.git
synced 2026-10-25 02:52:20 +02:00
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:
@@ -1,3 +1,3 @@
|
|||||||
api.yourdomain.com {
|
api.sshops.uk {
|
||||||
reverse_proxy api:8080
|
reverse_proxy api:8080
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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")
|
log.Println("WARNING: STRIPE_WEBHOOK_SECRET is not set; skipping signature verification")
|
||||||
} else {
|
} else {
|
||||||
sig := r.Header.Get("Stripe-Signature")
|
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)
|
utils.RespondError(w, http.StatusUnauthorized, "INVALID_SIGNATURE", "webhook signature verification failed", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user