Widget SDK Reference
Events Reference
Complete events reference for the PaySight Widget SDK
Events Reference
This document provides a comprehensive reference for all events emitted by the PaySight Widget SDK, including their types, payloads, and handling patterns.
Event System Overview
The PaySight Widget uses an event-driven architecture to communicate state changes, user interactions, and payment processing status. Events are handled through the onMessage
callback provided during widget initialization.
Widget Events Reference
Event Types
The PaySight Widget emits various events during its lifecycle. Here’s a comprehensive list of all available events:
Widget Lifecycle Events
READY
- Emitted when the widget is fully loaded and ready to accept inputMOUNT
- Emitted when the widget is mounted to the DOMUNMOUNT
- Emitted when the widget is unmounted from the DOMHEIGHT_CHANGE
- Emitted when the widget’s height changesFOCUS
- Emitted when a field in the widget receives focusBLUR
- Emitted when a field in the widget loses focus
Payment Events
PAYMENT_START
- Emitted when payment processing beginsPAYMENT_SUCCESS
- Emitted when payment is successfulPAYMENT_ERROR
- Emitted when payment failsPAYMENT_CANCEL
- Emitted when payment is cancelled
3D Secure Events
PAYMENT_3DS_START
- Emitted when 3DS verification beginsPAYMENT_3DS_SUCCESS
- Emitted when 3DS verification is successfulPAYMENT_3DS_ERROR
- Emitted when 3DS verification encounters an errorPAYMENT_3DS_FAILURE
- Emitted when 3DS verification failsPAYMENT_3DS_CANCEL
- Emitted when 3DS verification is cancelled
Validation Events
VALIDATION_ERROR
- Emitted when field validation failsVALIDATION_SUCCESS
- Emitted when field validation succeeds
Network Events
NETWORK_ERROR
- Emitted when a network request failsNETWORK_SUCCESS
- Emitted when a network request succeeds
Event Payloads
Each event type includes a specific payload structure:
Event Handling Example
Best Practices
- Always handle critical events like
PAYMENT_ERROR
andVALIDATION_ERROR
- Provide appropriate user feedback for each event type
- Implement proper error recovery mechanisms
- Log events for debugging purposes
- Handle network errors gracefully
- Manage widget state based on events
Event Debugging
Enable debug mode to see detailed event logs:
Next Steps
- API Reference - Complete API documentation
- Configuration Reference - Configuration options
- Basic Integration Example - Simple implementation example
- Error Handling Example - Advanced error handling