Ignore Stripe API version mismatch in webhook
This commit is contained in:
2
main.go
2
main.go
@@ -374,7 +374,7 @@ func handleStripeWebhook(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
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 {
|
if err != nil {
|
||||||
log.Println("[ERROR] failed to verify webhook:", err)
|
log.Println("[ERROR] failed to verify webhook:", err)
|
||||||
http.Error(w, "invalid signature", http.StatusBadRequest)
|
http.Error(w, "invalid signature", http.StatusBadRequest)
|
||||||
|
|||||||
@@ -140,7 +140,7 @@
|
|||||||
<wa-button variant="neutral" size="small" id="logout-btn">Switch User</wa-button>
|
<wa-button variant="neutral" size="small" id="logout-btn">Switch User</wa-button>
|
||||||
</div>
|
</div>
|
||||||
<div id="thank-you" class="thank-you" style="display: none;">
|
<div id="thank-you" class="thank-you" style="display: none;">
|
||||||
Thank you for your generous donation!
|
Thank you for your donation!
|
||||||
</div>
|
</div>
|
||||||
<wa-card>
|
<wa-card>
|
||||||
<div class="event-header">
|
<div class="event-header">
|
||||||
@@ -150,6 +150,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="rsvp-section">
|
<div class="rsvp-section">
|
||||||
<div id="rsvp-prompt">
|
<div id="rsvp-prompt">
|
||||||
|
<div id="prompt-donation-status" class="donation-info" style="display: none; margin-bottom: 1rem;"></div>
|
||||||
<strong>RSVP now!</strong>
|
<strong>RSVP now!</strong>
|
||||||
<div style="margin-top: 1rem;">Number of people:</div>
|
<div style="margin-top: 1rem;">Number of people:</div>
|
||||||
<div class="button-group" id="num-people-group">
|
<div class="button-group" id="num-people-group">
|
||||||
@@ -310,6 +311,13 @@
|
|||||||
} else {
|
} else {
|
||||||
document.getElementById('rsvp-prompt').style.display = 'block';
|
document.getElementById('rsvp-prompt').style.display = 'block';
|
||||||
document.getElementById('rsvp-status').style.display = 'none';
|
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';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user