Package com.stripe.examples
Class EventNotificationHandlerEndpoint
java.lang.Object
com.stripe.examples.EventNotificationHandlerEndpoint
Receive and process event notifications (AKA thin events) like
"v1.billing.meter.error_report_triggered" using EventNotificationHandler.
In this example, we:
- write a fallback callback to handle unrecognized event notifications
- create a StripeClient called client
- Initialize an EventNotificationHandler with the client, webhook secret, and fallback callback
- register a preHandle hook that deduplicates events by id before any callback runs
- register a specific handler for the "v1.billing.meter.error_report_triggered" event notification type
- use handler.handle() to process the received notification webhook body
We also expose a second endpoint for events that arrive through a pre-authenticated channel (such as AWS EventBridge or Azure Event Grid). Those payloads carry no Stripe-Signature header because the channel has already authenticated them, so they're routed through a handler created with notificationHandlerWithoutVerification().
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
EventNotificationHandlerEndpoint
public EventNotificationHandlerEndpoint()
-
-
Method Details
-
main
- Throws:
IOException
-