Package com.stripe
Class StripeEventNotificationHandler
java.lang.Object
com.stripe.StripeEventNotificationHandler
Verifies incoming webhook signatures before routing event notifications to the callbacks
registered on it. This is the handler you want unless events reach you through a channel that has
already authenticated them, in which case see
withoutVerification(StripeClient, EventNotificationFallbackCallback).-
Constructor Summary
ConstructorsConstructorDescriptionStripeEventNotificationHandler(String webhookSecret, StripeClient client, EventNotificationFallbackCallback fallbackCallback) -
Method Summary
Modifier and TypeMethodDescriptionGet a sorted list of all registered event types.voidHandle an incoming webhook event notification.onV1BillingMeterErrorReportTriggered(EventNotificationCallback<V1BillingMeterErrorReportTriggeredEventNotification> callback) onV1BillingMeterNoMeterFound(EventNotificationCallback<V1BillingMeterNoMeterFoundEventNotification> callback) onV2CommerceProductCatalogImportsFailed(EventNotificationCallback<V2CommerceProductCatalogImportsFailedEventNotification> callback) onV2CommerceProductCatalogImportsProcessing(EventNotificationCallback<V2CommerceProductCatalogImportsProcessingEventNotification> callback) onV2CommerceProductCatalogImportsSucceeded(EventNotificationCallback<V2CommerceProductCatalogImportsSucceededEventNotification> callback) onV2CommerceProductCatalogImportsSucceededWithErrors(EventNotificationCallback<V2CommerceProductCatalogImportsSucceededWithErrorsEventNotification> callback) onV2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification> callback) onV2CoreAccountIncludingConfigurationCustomerUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification> callback) onV2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification> callback) onV2CoreAccountIncludingConfigurationMerchantUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification> callback) onV2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification> callback) onV2CoreAccountIncludingConfigurationRecipientUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification> callback) onV2CoreAccountIncludingDefaultsUpdated(EventNotificationCallback<V2CoreAccountIncludingDefaultsUpdatedEventNotification> callback) onV2CoreAccountIncludingFutureRequirementsUpdated(EventNotificationCallback<V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification> callback) onV2CoreAccountIncludingIdentityUpdated(EventNotificationCallback<V2CoreAccountIncludingIdentityUpdatedEventNotification> callback) onV2CoreAccountIncludingRequirementsUpdated(EventNotificationCallback<V2CoreAccountIncludingRequirementsUpdatedEventNotification> callback) onV2CoreAccountLinkReturned(EventNotificationCallback<V2CoreAccountLinkReturnedEventNotification> callback) onV2CoreAccountPersonCreated(EventNotificationCallback<V2CoreAccountPersonCreatedEventNotification> callback) onV2CoreAccountPersonDeleted(EventNotificationCallback<V2CoreAccountPersonDeletedEventNotification> callback) onV2CoreAccountPersonUpdated(EventNotificationCallback<V2CoreAccountPersonUpdatedEventNotification> callback) onV2CoreEventDestinationPing(EventNotificationCallback<V2CoreEventDestinationPingEventNotification> callback) preHandle(EventNotificationPreHandleCallback callback) Registers a function that will be run before any event-specific callbacks.withoutVerification(StripeClient client, EventNotificationFallbackCallback fallbackCallback) Creates a handler that processes events without webhook signature verification.
-
Constructor Details
-
StripeEventNotificationHandler
public StripeEventNotificationHandler(String webhookSecret, StripeClient client, EventNotificationFallbackCallback fallbackCallback)
-
-
Method Details
-
withoutVerification
public static StripeEventNotificationHandlerWithoutVerification withoutVerification(StripeClient client, EventNotificationFallbackCallback fallbackCallback) Creates a handler that processes events without webhook signature verification. Intended for pre-authenticated channels like AWS EventBridge or Azure Event Grid. -
handle
Handle an incoming webhook event notification.- Parameters:
webhookBody- the incoming webhook bodysigHeader- the incoming webhook signature header- Throws:
SignatureVerificationException- if the validation of the webhook signature failsIllegalArgumentException- if no handler is registered for the event type
-
preHandle
Registers a function that will be run before any event-specific callbacks. A useful place to store event-agnostic logic, such as logging or checking for duplicate event deliveries.Returning
truecauses handling to continue as normal; returningfalsereturns fromhandle()immediately, so neither the registered callback nor the fallback callback are called.- Parameters:
callback- the hook to run before handling continues- Returns:
- this handler, for chaining
-
onV1BillingMeterErrorReportTriggered
public StripeEventNotificationHandler onV1BillingMeterErrorReportTriggered(EventNotificationCallback<V1BillingMeterErrorReportTriggeredEventNotification> callback) -
onV1BillingMeterNoMeterFound
public StripeEventNotificationHandler onV1BillingMeterNoMeterFound(EventNotificationCallback<V1BillingMeterNoMeterFoundEventNotification> callback) -
onV2CommerceProductCatalogImportsFailed
public StripeEventNotificationHandler onV2CommerceProductCatalogImportsFailed(EventNotificationCallback<V2CommerceProductCatalogImportsFailedEventNotification> callback) -
onV2CommerceProductCatalogImportsProcessing
public StripeEventNotificationHandler onV2CommerceProductCatalogImportsProcessing(EventNotificationCallback<V2CommerceProductCatalogImportsProcessingEventNotification> callback) -
onV2CommerceProductCatalogImportsSucceeded
public StripeEventNotificationHandler onV2CommerceProductCatalogImportsSucceeded(EventNotificationCallback<V2CommerceProductCatalogImportsSucceededEventNotification> callback) -
onV2CommerceProductCatalogImportsSucceededWithErrors
public StripeEventNotificationHandler onV2CommerceProductCatalogImportsSucceededWithErrors(EventNotificationCallback<V2CommerceProductCatalogImportsSucceededWithErrorsEventNotification> callback) -
onV2CoreAccountClosed
public StripeEventNotificationHandler onV2CoreAccountClosed(EventNotificationCallback<V2CoreAccountClosedEventNotification> callback) -
onV2CoreAccountCreated
public StripeEventNotificationHandler onV2CoreAccountCreated(EventNotificationCallback<V2CoreAccountCreatedEventNotification> callback) -
onV2CoreAccountUpdated
public StripeEventNotificationHandler onV2CoreAccountUpdated(EventNotificationCallback<V2CoreAccountUpdatedEventNotification> callback) -
onV2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification> callback) -
onV2CoreAccountIncludingConfigurationCustomerUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationCustomerUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification> callback) -
onV2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification> callback) -
onV2CoreAccountIncludingConfigurationMerchantUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationMerchantUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification> callback) -
onV2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification> callback) -
onV2CoreAccountIncludingConfigurationRecipientUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationRecipientUpdated(EventNotificationCallback<V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification> callback) -
onV2CoreAccountIncludingDefaultsUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingDefaultsUpdated(EventNotificationCallback<V2CoreAccountIncludingDefaultsUpdatedEventNotification> callback) -
onV2CoreAccountIncludingFutureRequirementsUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingFutureRequirementsUpdated(EventNotificationCallback<V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification> callback) -
onV2CoreAccountIncludingIdentityUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingIdentityUpdated(EventNotificationCallback<V2CoreAccountIncludingIdentityUpdatedEventNotification> callback) -
onV2CoreAccountIncludingRequirementsUpdated
public StripeEventNotificationHandler onV2CoreAccountIncludingRequirementsUpdated(EventNotificationCallback<V2CoreAccountIncludingRequirementsUpdatedEventNotification> callback) -
onV2CoreAccountLinkReturned
public StripeEventNotificationHandler onV2CoreAccountLinkReturned(EventNotificationCallback<V2CoreAccountLinkReturnedEventNotification> callback) -
onV2CoreAccountPersonCreated
public StripeEventNotificationHandler onV2CoreAccountPersonCreated(EventNotificationCallback<V2CoreAccountPersonCreatedEventNotification> callback) -
onV2CoreAccountPersonDeleted
public StripeEventNotificationHandler onV2CoreAccountPersonDeleted(EventNotificationCallback<V2CoreAccountPersonDeletedEventNotification> callback) -
onV2CoreAccountPersonUpdated
public StripeEventNotificationHandler onV2CoreAccountPersonUpdated(EventNotificationCallback<V2CoreAccountPersonUpdatedEventNotification> callback) -
onV2CoreEventDestinationPing
public StripeEventNotificationHandler onV2CoreEventDestinationPing(EventNotificationCallback<V2CoreEventDestinationPingEventNotification> callback) -
getRegisteredEventTypes
Get a sorted list of all registered event types.- Returns:
- A sorted list of event type strings
-