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)

View File

@@ -140,7 +140,7 @@
<wa-button variant="neutral" size="small" id="logout-btn">Switch User</wa-button>
</div>
<div id="thank-you" class="thank-you" style="display: none;">
Thank you for your generous donation!
Thank you for your donation!
</div>
<wa-card>
<div class="event-header">
@@ -150,6 +150,7 @@
</div>
<div class="rsvp-section">
<div id="rsvp-prompt">
<div id="prompt-donation-status" class="donation-info" style="display: none; margin-bottom: 1rem;"></div>
<strong>RSVP now!</strong>
<div style="margin-top: 1rem;">Number of people:</div>
<div class="button-group" id="num-people-group">
@@ -310,6 +311,13 @@
} else {
document.getElementById('rsvp-prompt').style.display = 'block';
document.getElementById('rsvp-status').style.display = 'none';
const promptDonation = document.getElementById('prompt-donation-status');
if (data.donation > 0) {
promptDonation.textContent = `You've donated $${data.donation.toFixed(2)}. Thank you!`;
promptDonation.style.display = 'block';
} else {
promptDonation.style.display = 'none';
}
}
}