The Paysight Widget is highly configurable to meet your business needs. This guide covers required parameters , customer data handling, optional settings, and best practices for a robust integration.
Required Parameters
Your Paysight product ID that identifies your merchant account and product configuration. 7900 can be used for testing purposes. productId : 7900 // or input your own created productId from Paysight Dashboard
A unique identifier for the payment session. This should be unique for each payment attempt. sessionId : 'unique-session-id'
The payment amount in the selected currency. 1.00 = $1.00 is the default value for testing or a specified amount for live testing (e.g. 14.99 = $14.99).
The environment to run the widget in. The options are ‘production’ and ‘sandbox’. environment : 'production' // or 'sandbox'
Semi-Required Customer Data
The following customer fields are semi-required. They can be provided either via the customer object or as fields in the fields array.
Customer’s first name. Can be provided via customer object or a name field.
Customer’s last name. Can be provided via customer object or a name field.
Customer’s state/province. Can be provided via customer object or a state field.
Customer’s country code (e.g., ‘US’). Can be provided via customer object or a country field. This string is only required if the country is US.
Optional Parameters
Enable 3D Secure authentication for the payment. Recommended for enhanced security.
Do not display 3DS challenge if set to true. Proceed to payment without 3DS.
Cancel the payment if the 3DS not successfully completed.
Enable ecommerce mode. This is used if the payment is for a ecommerce product. Currently not supported in the widget. Stay tuned for updates on this feautre.
Set the language and region for the widget interface.
The currency code for the payment. Must be a valid ISO 4217 currency code.
Custom text for the payment button. Use this to match your brand voice or specific action.
UI theme customization options to match your brand. Includes font, colors, and styling.
Override the merchant ID for the payment. Requires special permissions.
Disable specific card types from being used in the payment. Supported values:
visa
mastercard
american-express
discover
diners
jcb
disabledCardTypes : [ 'american-express' ]
Additional custom data to include with the payment. Useful for tracking and analytics. data : {
clickId : 'ad-campaign-123' ,
// More properties to be supported soon
}
Fields Configuration
The fields parameter allows you to customize the form fields displayed in the widget. This is useful for collecting additional information from customers or customizing the checkout experience.
An array of field configuration objects that define custom form fields. fields : [
{
label: 'Email Address' ,
placeholder: 'Enter your email' ,
fieldType: 'email' ,
position: 'above' ,
size: 'full' ,
},
// Additional fields
{
label: 'Phone Number' ,
placeholder: 'Enter your phone number' ,
fieldType: 'phone' ,
position: 'above' ,
size: 'full'
},
{
label: 'Company Name' ,
placeholder: 'Enter your company name' ,
fieldType: 'text' ,
position: 'above' ,
size: 'half'
}
]
Each field object supports the following properties:
The label text displayed to the user.
Placeholder text shown in the input field when empty.
The type of field to display. Supported values:
email - Email address input with validation (required)
name - Name input field
phone - Phone number input with formatting
address - Street address input
city - City input
state - State/province input
zip - Postal/ZIP code input
It is recommended to put a real ZIP code if you were to test live MIDs due to Address Verification Service (AVS) check, which is a fraud prevention measure used for processing credit card transactions.
country - Country selection dropdown
text - Generic text input
divider - Visual divider (not an input field)
Label position relative to the input field. Options: above or below.
Field width within the form. Options: full, half, or third.
Whether the field is required to be filled before submission.
Theme Configuration
The theme parameter allows you to customize the appearance of the widget to match your brand.
Object containing theme customization options. theme : {
font : 'https://fonts.googleapis.com/css2?family=Inter' ,
themeName : 'light' , // or 'dark'
css : {
'.ps-field-input' : {
borderRadius: '8px' ,
border: '1px solid #e5e7eb'
},
'.ps-submit' : {
backgroundColor: '#5D4CFE' ,
color: 'white' ,
borderRadius: '8px'
}
}
}
URL to a custom font to use in the widget. We currently support Google Fonts only. This is a beta feature.
Base theme to use. Options: light or dark.
Custom CSS properties for different widget elements.
Additional Data
The data parameter allows you to include custom data with the payment transaction, which is useful for tracking and analytics.
An object containing additional data to associate with the payment. data : {
clickId : 'click_12345' ,
campaignId : 'summer-promo-2023' ,
affiliateId : 'partner-001' ,
gclid : 'CjwKCAiAzc2tBhA4EiwA5gFXtqxZQn8H9XdF9jKm' , // Google Click Identifier
wbraid : 'CLjQ5oGVqvsCFQiNaAodgM4PqA' , // Web BRAID for Google Ads
gbraid : 'CLjQ5oGVqvsCFQiNaAodgM4PqA' , // Google BRAID for app tracking
// Additional custom properties
}
Google tracking parameters (gclid, wbraid, and gbraid) are automatically captured from URL parameters when available, but can also be manually specified.
Feature-Specific Configuration
Custom Button Text
Merchant ID Override
You can customize the text displayed on the payment button to better match your brand voice or the specific action being taken. The custom button feature allows you to replace the default “Pay Now” text with your own text, such as “Complete Purchase”, “Subscribe”, or “Donate Now”.
Default Button Text By default, the payment button displays “Pay Now” or its localized equivalent based on the selected locale. You can customize the text displayed on the payment button using the buttonText property: const config = {
// ... other fields
buttonText: 'Complete Purchase' // Custom button text
};
This allows you to:
Match the button text to your specific use case (e.g., “Subscribe”, “Donate”, “Pay Now”)
Maintain consistent language across your application
Improve conversion rates with action-oriented text
const widget = PaysightSDK . createWidget ({
targetId: 'payment-form' ,
config: {
productId: 1234 ,
sessionId: 'unique-session-id' ,
amount: 29.99 , // $29.99
environment: 'production' ,
fields: [
{
label: 'Email Address' ,
placeholder: 'Enter your email' ,
fieldType: 'email' ,
position: 'above' ,
size: 'full' ,
required: true
}
],
buttonText: 'Subscribe Now' // Custom button text for subscription
}
});
The button text will automatically update when the payment is processing to indicate the current state.
For advanced use cases, you can override the default merchant ID using the midOverride property: const config = {
// ... other fields
midOverride: 'MERCHANT_123' // Override merchant ID
};
This feature is useful for:
Multi-merchant platforms
White-label solutions
Testing specific merchant configurations
Basic Override
Dynamic Override
const widget = PaysightSDK . createWidget ({
targetId: 'payment-form' ,
config: {
productId: 1234 ,
sessionId: 'unique-session-id' ,
amount: 99.99 , // $99.99
environment: 'production' ,
fields: [
{
label: 'Email Address' ,
placeholder: 'Enter your email' ,
fieldType: 'email' ,
position: 'above' ,
size: 'full' ,
required: true
}
],
midOverride: 'MERCHANT_123' // Use specific merchant ID
}
});
Complete Configuration Example
<! DOCTYPE html >
< html lang = "en" >
< head >
< meta charset = "UTF-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< title > Paysight Widget Example </ title >
<!-- Add the Paysight Widget SDK -->
< script src = "https://payment.paysight.io/widget-sdk.js" ></ script >
< style >
.container {
max-width : 600 px ;
margin : 40 px auto ;
padding : 20 px ;
}
.widget-container {
border : 1 px solid #e5e7eb ;
border-radius : 8 px ;
padding : 20 px ;
}
.status {
padding : 12 px ;
border-radius : 6 px ;
margin-bottom : 16 px ;
display : none ;
}
.error {
background-color : #fee2e2 ;
border : 1 px solid #ef4444 ;
color : #b91c1c ;
}
.success {
background-color : #dcfce7 ;
border : 1 px solid #22c55e ;
color : #15803d ;
}
</ style >
</ head >
< body >
< div class = "container" >
< div id = "success-message" class = "status success" ></ div >
< div id = "error-message" class = "status error" ></ div >
< div id = "widget-container" class = "widget-container" ></ div >
</ div >
< script >
// Initialize widget
const widget = PaysightSDK . createWidget ({
targetId: 'widget-container' ,
config: {
// Required parameters
productId: 7900 , // replace with your actual product ID
sessionId: new Date (). getTime (). toString (),
environment: 'sandbox' ,
amount: 1.00 ,
// Pre-filled customer data
customer: {
email: '[email protected] ' ,
firstName: 'John' ,
lastName: 'Doe' ,
state: 'CA' ,
country: 'US'
},
fields: [
{
label: 'Email Address' ,
placeholder: 'Enter your email' ,
fieldType: 'email' ,
position: 'above' ,
size: 'full' ,
},
{
label: 'Full Name' ,
placeholder: 'Enter your full name' ,
fieldType: 'name' ,
position: 'above' ,
size: 'full'
},
{
label: 'Country' ,
placeholder: 'Select your country' ,
fieldType: 'country' ,
position: 'above' ,
size: 'half'
},
{
label: 'State/Province' ,
placeholder: 'Enter your state' ,
fieldType: 'state' ,
position: 'above' ,
size: 'half'
}
],
// Optional parameters
threeDSRequired: false ,
failOnThreeDSChallenge: false ,
cancelOnThreeDSFailure: false ,
currency: 'USD' ,
locale: 'en-US' ,
buttonText: 'Pay Now' ,
// Additional data for tracking
data: {
clickId: 'campaign-123' ,
gclid: 'CjwKCAiAzc2tBhA4EiwA5gFXtqxZQn8H9XdF9jKm' ,
wbraid: 'CLjQ5oGVqvsCFQiNaAodgM4PqA' ,
gbraid: 'CLjQ5oGVqvsCFQiNaAodgM4PqA'
}
},
onReady : () => {
console . log ( 'Widget is ready' );
},
onError : ( error ) => {
const errorElement = document . getElementById ( 'error-message' );
errorElement . textContent = error . message ;
errorElement . style . display = 'block' ;
console . error ( 'Widget error:' , error );
},
onMessage : ( message ) => {
switch ( message . type ) {
case 'PAYMENT_SUCCESS' :
const successElement = document . getElementById ( 'success-message' );
successElement . textContent = `Payment successful! Transaction ID: ${ message . payload . transactionId } ` ;
successElement . style . display = 'block' ;
break ;
case 'PAYMENT_ERROR' :
const errorElement = document . getElementById ( 'error-message' );
errorElement . textContent = message . payload . message ;
errorElement . style . display = 'block' ;
break ;
}
}
});
// Example of updating customer data later
function updateCustomerData () {
widget . update ({
customer: {
email: '[email protected] ' ,
firstName: 'Jane' ,
lastName: 'Smith' ,
phone: '+1234567890' ,
address: '123 Main St' ,
city: 'Anytown' ,
state: 'NY' ,
zip: '00000' ,
country: 'US'
}
});
}
</ script >
</ body >
</ html >
Configuration Best Practices
Validate Required Fields
Always ensure all required fields are provided with valid values. Missing or invalid required fields will prevent the widget from initializing properly.
Use Unique Session IDs
Generate a unique session ID for each payment attempt to prevent duplicate charges and ensure proper tracking. // Generate a unique session ID
const sessionId = `session_ ${ Date . now () } _ ${ Math . random (). toString ( 36 ). substring ( 2 , 9 ) } ` ;
Implement Error Handling
Always provide an onError handler to catch and respond to configuration errors. onError : ( error ) => {
console . error ( 'Configuration error:' , error );
showErrorMessage ( `Payment form error: ${ error . message } ` );
}
Test Configuration Changes
When updating configuration dynamically, test all possible combinations to ensure a smooth user experience. // Update configuration based on user selection
document . getElementById ( 'currency-selector' ). addEventListener ( 'change' , ( e ) => {
const selectedCurrency = e . target . value ;
widget . update ({ currency: selectedCurrency });
});
Use test card numbers
In Sandbox mode, you can use specific test cards to simulate various real-life scenarios. These cards can be used with any valid expiry date and CVV.
Successful Payment Card: 4242 4242 4242 4242
Expiry: Any future date
CVV: Any 3 digits
Failed Payment Card: 4000 0000 0000 0002
Expiry: Any future date
CVV: Any 3 digits
Visa (Credit) Card: 4532 1111 1111 1112
Expiry: Any future date
CVV: First 3 digits from the card (453)
Mastercard (Credit) Card: 5411 1111 1111 1115
Expiry: Any future date
CVV: First 3 digits from the card (453)
You can check NMI’s full Test Cards here . Which includes more card schemes, AVS test cards and PAR test response. These cards will trigger a 3D-Secure challenge flow, requiring additional authentication:
Visa Any valid Visa card
Expiry: Any future date
CVV: Any 3 digits
Mastercard Any valid Mastercard
Expiry: Any future date
CVV: Any 3 digits
American Express Any valid Amex card
Expiry: Any future date
CVV: Any 4 digits
These cards will trigger a successful 3D-Secure frictionless flow (no challenge):
Visa 4111 1101 1663 8870
Expiry: Any future date
CVV: Any 3 digits
Mastercard 5555 5501 3065 9057
Expiry: Any future date
CVV: Any 3 digits
American Express 3782 8224 6310 005
Expiry: Any future date
CVV: Any 4 digits
These cards will trigger a failed 3D-Secure frictionless flow:
Visa 4111 1117 3897 3695
Expiry: Any future date
CVV: Any 3 digits
Mastercard 5555 5504 8784 7545
Expiry: Any future date
CVV: Any 3 digits
American Express 3782 8224 6310 013
Expiry: Any future date
CVV: Any 4 digits
These cards will trigger an attempted authentication flow:
Visa 4111 1101 4848 6405
Expiry: Any future date
CVV: Any 3 digits
Mastercard 5555 5588 2481 5604
Expiry: Any future date
CVV: Any 3 digits
American Express 3782 8224 6310 021
Expiry: Any future date
CVV: Any 4 digits
When prompted for 3DS authentication in test mode, use any value to complete the process.
Next Steps