Embed the Payviox payment form directly in your page using an iframe. Requires domain whitelisting. Configure width, height, border, transparency via iframeConfig. Handles payviox:redirect and payviox:close postMessage events for provider redirects and iframe dismissal. Includes standalone integration example without SDK.
Iframe mode allows you to embed the Payviox payment flow directly into your website, providing a seamless user experience without redirecting customers away from your page.
Domain whitelisting required: Your domain must be whitelisted in your Payviox dashboard settings to use iframe mode.
When using iframe mode, the payment page communicates with the parent window via the postMessage API. The SDK handles these events automatically, but you can also listen for them directly if you are embedding the iframe without the SDK.
Customer clicked “Back to merchant” — the iframe should be removed
{ type: 'payviox:close' }
Redirect-type payments (PayPal, Pallapay, etc.) cannot be displayed inside an iframe due to security restrictions (X-Frame-Options). When the customer selects one of these methods, the payment page sends a payviox:redirect event to navigate the full page to the provider.
// Verify that target element existsconst target = document.getElementById('payment-container');if (!target) { console.error('Payment container not found');}// Check console for CSP errors// Add to your HTML if needed:// <meta http-equiv="Content-Security-Policy" // content="frame-src https://secure.payviox.com;">
Iframe height not adjusting
Solution: Set a fixed minimum height or use viewport units:
Solution: Ensure you’re listening before creating the session:
// First configure the listenerwindow.addEventListener('message', handlePaymentMessage);// Then create the sessionawait payviox.createSession(params, iframeConfig);