Widget Configuration

Core Configuration Options

Required Parameters

productId
number
required

Your PaySight product ID that identifies your merchant account and product configuration.

productId: 123
sessionId
string
required

A unique identifier for the payment session. This should be unique for each payment attempt.

sessionId: 'unique-session-xyz'
amount
number
required

The payment amount in cents. For example, $29.99 would be represented as 2999.

amount: 2999 // $29.99
environment
string
required

The environment to run the widget in. Use ‘sandbox’ for testing and ‘production’ for live payments.

environment: 'production' // or 'sandbox'

Required Form Fields

fields
array
required

An array of field configuration objects that define form fields. Must include an email field.

fields: [
  {
    label: 'Email Address',
    placeholder: 'Enter your email',
    fieldType: 'email',
    position: 'above',
    size: 'full',
    required: true  // Email field is required
  }
]

Semi-Required Customer Data

customer.firstName
string

Customer’s first name. Can be provided via customer object or a name field.

customer.lastName
string

Customer’s last name. Can be provided via customer object or a name field.

customer.state
string

Customer’s state/province. Can be provided via customer object or a state field.

customer.country
string

Customer’s country code (e.g., ‘US’). Can be provided via customer object or a country field.

Optional Parameters

threeDSRequired
boolean
default:"false"

Enable 3D Secure authentication for the payment. Recommended for enhanced security.

threeDSRequired: true
ecom
boolean
default:"false"

Enable ecommerce mode with additional fields for shipping and billing information.

ecom: true
locale
string
default:"en-US"

Set the language and region for the widget interface.

locale: 'fr-FR'
currency
string
default:"USD"

The currency code for the payment. Must be a valid ISO 4217 currency code.

currency: 'EUR'
buttonText
string
default:"Pay Now"

Custom text for the payment button. Use this to match your brand voice or specific action.

buttonText: 'Subscribe Now'
midOverride
string

Override the merchant ID for the payment. Requires special permissions.

midOverride: 'MID_NUMBER'
data
object

Additional custom data to include with the payment. Useful for tracking and analytics.

data: {
  // PaySight tracking parameters
  campaignId: 'cmpid',      // PaySight campaign identifier
  affiliateId: 'affid',    // PaySight affiliate identifier
  subAffiliateId: 'subid', // PaySight sub-affiliate identifier
  trackhouseClickId: 'trfk_id',  // PaySight tracking click identifier
  
  // Generic tracking
  clickId: 'ad-campaign-123',      // Generic click identifier
  
  
  // Custom data
  customData: {
    plan: 'premium',
    term: 'annual'
  }
}

PaySight Tracking Parameters

data.campaignId
string

PaySight campaign identifier for tracking marketing campaigns and their performance.

data.affiliateId
string

PaySight affiliate identifier for tracking specific affiliate partners.

data.subAffiliateId
string

PaySight sub-affiliate identifier for more granular affiliate tracking.

data.trackhouseClickId
string

PaySight tracking click identifier for detailed click tracking and attribution.

data.clickId
string

Generic click identifier for tracking ad campaigns or affiliate links from any source.

data.gclid
string

Google Click Identifier (gclid) for tracking Google Ads clicks and conversions.

data.wbraid
string

Web BRAID identifier for Google Ads tracking in browsers with limited third-party cookies.

data.gbraid
string

Google BRAID identifier for app conversion tracking and attribution.

Use Cases for Additional Data

  • Campaign Tracking: Track specific marketing campaigns and their performance
  • Affiliate Management: Monitor affiliate and sub-affiliate performance
  • Click Attribution: Track the source of conversions with click IDs
  • Google Ads Tracking: Track conversions from Google Ads campaigns using gclid, wbraid, and gbraid
  • Custom Analytics: Include additional metadata for reporting and analysis

Customer Data Pre-filling

customer
object

Pre-fill customer information to streamline the checkout process. This will populate the corresponding form fields.

customer: {
  email: 'customer@example.com',
  firstName: 'John',
  lastName: 'Doe',
  phone: '+1234567890',
  address: '123 Main St',
  city: 'San Francisco',
  state: 'CA',
  zip: '94103',
  country: 'US'
}

Theme Customization

theme
object

Customize the widget appearance to match your brand.

theme: {
  font: 'https://fonts.googleapis.com/css2?family=Inter',
  themeName: 'light', // or 'dark'
  css: {
    input: {
      borderRadius: '8px',
      border: '1px solid #e5e7eb'
    },
    button: {
      backgroundColor: '#5D4CFE',
      color: 'white',
      borderRadius: '8px'
    }
  }
}

Custom Form Fields

fields
array

An array of field configuration objects that define custom form fields.

fields: [
  // Required email field
  {
    label: 'Email Address',
    placeholder: 'Enter your email',
    fieldType: 'email',
    position: 'above',
    size: 'full',
    required: true
  },
  // 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:

label
string
required

The label text displayed to the user.

placeholder
string

Placeholder text shown in the input field when empty.

fieldType
string
required

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
  • country - Country selection dropdown
  • text - Generic text input
  • divider - Visual divider (not an input field)
position
string
default:"above"

Label position relative to the input field. Options: above or below.

size
string
default:"full"

Field width within the form. Options: full, half, or third.

required
boolean
default:"false"

Whether the field is required to be filled before submission.

Feature-Specific Configuration

Ecommerce Mode is designed for online shopping carts and product purchases. It displays a summary of the purchase including product details, quantity, and total amount.

Key Features

  • Product summary display
  • Quantity indicator
  • Price breakdown
  • Order total calculation

The ecom flag enables ecommerce-specific features and optimizations:

const config = {
  // ... other required fields
  ecom: true // Enable ecommerce mode
};

When enabled, this flag:

  • Optimizes the payment flow for ecommerce transactions
  • Enables additional ecommerce-specific validations
  • Adjusts the UI for better integration with shopping cart experiences

Complete Configuration Example

Configuration Best Practices

1

Include Required Email Field

Always include an email field in your form configuration, even if you’re pre-filling it with customer data.

fields: [
  {
    label: 'Email Address',
    placeholder: 'Enter your email',
    fieldType: 'email',
    position: 'above',
    size: 'full',
    required: true
  }
]
2

Validate Required Fields

Always ensure all required fields are provided with valid values.

3

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)}`;
4

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}`);
}
5

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 });
});
6

Use Test Cards in Sandbox

When testing in the sandbox environment, use specific test cards to simulate various payment scenarios:

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

Next Steps