Skip to main content
The Paysight Widget uses a message-based system to communicate events and state changes between your application and the widget. This guide explains how to implement effective event handling.

Event System Overview

Events are handled through the onMessage callback provided during widget initialization:
Each event message has a consistent structure:
Always check the event type before accessing payload properties, as the payload structure varies by event type.

Event Types

Lifecycle Events

Events related to the widget’s lifecycle:
The READY event indicates that the widget is fully initialized and ready to accept user input. This is a good time to hide any loading indicators.
Events related to the payment process:
Always implement handlers for PAYMENT_SUCCESS and PAYMENT_ERROR events to provide appropriate feedback to users.
Events related to 3DS verification:
3DS events are only triggered when 3D Secure authentication is enabled in your widget configuration.
Events related to form interactions:
Form events can be useful for tracking user progress and implementing custom validation logic.

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.
Clear user feedback improves conversion rates and reduces support inquiries.

Redirect After Payment

Updating Order Status

Next Steps

Styling Guide

Learn how to customize the widget appearance to match your brand.

Localization Guide

Implement multi-language support for global customers.

Events Reference

Complete events documentation