At a Glance
Section | Description |
---|---|
Architecture | Widget isolation and communication model |
Widget Instance | Creating, updating, destroying the widget |
Configuration | Key settings, fields, appearance parameters |
Security | PCI, 3D Secure, real-time validation |
State Management | Widget lifecycle, event handling |
Best Practices | Error management, resource cleanup |
Architecture Overview
Paysight Widget SDK is architected for secure, modular, and efficient payment integration within any web application. This document covers the fundamental principles, structure, and key best practices for leveraging the SDK to its fullest.Secure iFrame Integration
All payment flow occurs within a secure iFrame embedded on your site:- PCI DSS compliant—no payment data on your servers
- Cross-origin isolation prevents data leakage
- Simple, drop-in code to add to your app
Sensitive payment data always remains in the Paysight environment, your site never sees or stores card information.
Message Based Communication
- Uses browser
postMessage
API for all widget–parent communication - Bi-directional: Send config, receive results/events
- Only validated, type-safe messages are permitted
- Enables real-time UI updates, event-based flows, and analytics
Widget Instance
This is the main interface for controlling the payment widget:- Initialization ->
- Update ->
- Destroy
Initialization: Attach to a DOM element via
targetId
Configuration
Control the widget’s behavior and appearance usingWidgetConfig
.
Check the Widget Configuration field types at Technical Reference - Widget Configuration
Field and Theme Customization
- Field Example
- Theming Example
name
, email
, phone
, address
, city
, state
, zip
, country
, divider
.Event System
Receive payment results and state changes through event handlers:- onMessage: Receives state changes (payment, fields, status)
- onError: Catches integration errors
Always bind both
onMessage
and onError
to ensure you catch all outcomes and errors during integration.Security & Compliance
- PCI DSS Compliant: Sensitive card data is managed inside Paysight’s secure iFrame—not on your infrastructure.
- 3D Secure Support: Enable with
threeDSRequired: true
, handled automatically by the widget.- Example:
- Real-Time Validation: All data and messages are validated before processing.
- Safe by Design: Only trusted origins can exchange data with the widget.
Never store, log, or transmit cardholder data outside the Paysight widget.
State Management
Widget Lifecycle Steps
- Initialize:
- Update config dynamically:
- Cleanup:
Best Practices
- Use a unique
sessionId
for each transaction—improves security and reporting. - Always register
onError
and handle errors defensively. - Call
destroy()
when you remove the widget, especially in single-page apps. - Test integration fully in the
sandbox
environment before production launch. - For best developer experience, use TypeScript to benefit from the provided interfaces.
- Example:
Troubleshooting
For more on error codes and integration troubleshooting, visit the Widget SDK Troubleshooting Guide.
- Initialization errors → double-check required config fields.
- Cross-origin/messaging errors → verify origin and CSP.
- Form validation errors → confirm types and supported locales.
Next Steps
Widget Configuration Guide
Explore all configuration options for the widget.
Events Reference
Reference for events and handling.
Styling Guide
Check all supported CSS classes from our Styling Guide.
Troubleshooting
Diagnose and resolve common issues you may encounter when using Paysight Widget SDK