Integration Guides
Event Handling
Learn how to handle events and messages from the PaySight Widget
Event Handling
Event System Overview
Events are handled through the onMessage
callback provided during widget initialization:
Each event message has a consistent structure:
Each event message has a consistent structure:
The PaySight Widget communicates with your application through a series of events during key stages of the payment process:
- Widget Initialization: The widget sends a
READY
event when it’s fully loaded and ready to accept input. - Form Interaction: As users interact with the form, events like
FORM_FIELD_CHANGE
andFORM_VALIDATION
are triggered. - Payment Processing: When a payment is submitted, events like
PAYMENT_START
,PAYMENT_SUCCESS
, orPAYMENT_ERROR
are sent. - 3D Secure (if enabled): Additional events for 3DS authentication flow.
Event Types
Implementing Event Handlers
Best Practices
1
Handle Critical Events
Always implement handlers for these critical events:
2
Implement Error Recovery
3
Maintain UI State
4
Provide User Feedback
Always update your UI based on event messages to keep users informed about the payment process status.
Next Steps
- Styling Guide - Learn how to customize the widget appearance
- Localization Guide - Implement multi-language support
- Examples - View implementation examples
- Events Reference - Complete events documentation