Pay4Pixels Secure Seller Iframe Integration

This guide explains how to securely integrate the Pay4Pixels seller items iframe into your website, with the seller ID embedded in the iframe rather than exposed in the URL.

Enhanced Security: This approach hides the seller ID from the URL, making it less visible to users and reducing the risk of tampering.

Secure Implementation

To securely embed a seller's products on your site, add the following code:

<div id="sellerIframeContainer"></div>

<script>
    const sellerId = "YOUR_SELLER_ID";
    
    const iframe = document.createElement('iframe');
    iframe.src = "https://br.pay4pixels.com/iframe/v1/seller-list-iframe.html";
    iframe.width = "100%";
    iframe.height = "600px";
    iframe.frameBorder = "0";
    iframe.scrolling = "no";
    iframe.allowFullscreen = true;
    
    document.getElementById('sellerIframeContainer').appendChild(iframe);
    
    iframe.onload = function() {
        try {
            iframe.contentDocument.documentElement.setAttribute('data-seller-id', sellerId);
            
            iframe.contentWindow.postMessage({
                type: 'setSellerID',
                sellerId: sellerId
            }, '*');
        } catch(e) {
            console.error('Error setting seller ID:', e);
        }
    };
    
    window.addEventListener('message', function(event) {
        if (event.data.type === 'resize' && event.data.height) {
            iframe.style.height = event.data.height + 'px';
        }
    });
</script>

Replace YOUR_SELLER_ID with your actual seller ID.

Secure Implementation with Styling

To customize the colors and appearance while keeping your seller ID secure:

<div id="sellerIframeContainer"></div>

<script>
    // Your secure seller ID
    const sellerId = "YOUR_SELLER_ID";
    
    // Styling options
    const styling = {
        primaryColor: "#4CAF50",   // Button color
        secondaryColor: "#e91e63", // Price color
        bgColor: "#f9f9f9",        // Background color
        borderRadius: "8",         // Rounded corners (px)
        textColor: "#333333"       // Text color
    };
    
    // Build the URL with styling parameters
    let iframeUrl = "https://br.pay4pixels.com/iframe/v1/seller-list-iframe.html";
    const params = new URLSearchParams();
    
    // Add all styling parameters
    Object.keys(styling).forEach(key => {
        params.append(key, styling[key]);
    });
    
    // Append parameters to URL if any exist
    if (params.toString()) {
        iframeUrl += "?" + params.toString();
    }
    
    // Create the iframe
    const iframe = document.createElement('iframe');
    iframe.src = iframeUrl;
    iframe.width = "100%";
    iframe.height = "600px";
    iframe.frameBorder = "0";
    iframe.scrolling = "no";
    iframe.allowFullscreen = true;
    
    // Add to container
    document.getElementById('sellerIframeContainer').appendChild(iframe);
    
    // Set seller ID securely when iframe loads
    iframe.onload = function() {
        try {
            iframe.contentDocument.documentElement.setAttribute('data-seller-id', sellerId);
            
            iframe.contentWindow.postMessage({
                type: 'setSellerID',
                sellerId: sellerId
            }, '*');
        } catch(e) {
            console.error('Error setting seller ID:', e);
        }
    };
    
    // Handle auto-resize
    window.addEventListener('message', function(event) {
        if (event.data.type === 'resize' && event.data.height) {
            iframe.style.height = event.data.height + 'px';
        }
    });
</script>

Customize the styling object values to match your website's design.

Important:

Iframe Generator

Create Your Secure Iframe Code

Demo

Secure Iframe Example (Seller ID: 21)