Package com.chargebee.v4.webhook
Interface WebhookEventCallback<T>
- Type Parameters:
T- The typed event class (e.g., CustomerCreatedEvent, SubscriptionCreatedEvent)
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface for handling Chargebee webhook events.
Implement this interface to create handlers for specific event types. The callback receives the fully typed event object from the SDK.
Example usage:
handler.on(Event.EventType.CUSTOMER_CREATED, CustomerCreatedEvent.class, (typedEvent) -> {
Customer customer = typedEvent.getContent().getCustomer();
System.out.println("New customer: " + customer.getId());
return WebhookResult.success(typedEvent.getEventType(), typedEvent.getId());
});
-
Method Summary
Modifier and TypeMethodDescriptionHandles a webhook event and returns the processing result.
-
Method Details
-
handle
Handles a webhook event and returns the processing result.- Parameters:
typedEvent- The typed event object with strongly-typed content- Returns:
- WebhookResult indicating the outcome of processing
- Throws:
Exception- if event processing fails
-