Overview
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.How it works
1
Create payment session
Your application creates a payment session with iframe mode enabled.
2
Embed iframe
The SDK automatically creates and embeds an iframe in your specified target element.
3
Customer completes payment
Customer interacts with the payment form inside the iframe without leaving your page.
4
Handle completion
Listen for completion events via postMessage API to handle successful payments.
Basic implementation
Recommended: session created by your backend
Your server creates the session with your secret key, and the SDK embeds it — the recommended integration, in iframe form:Minimal iframe integration (no backend)
The SDK creates the session itself; it only needs a target container:The payment form will be loaded directly inside the specified container element.
Configuration options
Iframe configuration parameters
boolean
required
Enable iframe integration mode. Must be set to
true.object
required
Configuration object for iframe behavior and appearance.
Handling iframe events
When using iframe mode, the payment page communicates with the parent window via thepostMessage API. The SDK handles these events automatically, but you can also listen for them directly if you are embedding the iframe without the SDK.
Event types
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.Standalone integration (without SDK)
If you embed the Payviox iframe manually without using the SDK, you must listen for these events yourself:Troubleshooting
Iframe not displaying
Iframe not displaying
Possible causes:
- Domain not whitelisted
- Invalid iframe target element
- Content Security Policy blocking iframe
Iframe height not adjusting
Iframe height not adjusting
Solution: Set a fixed minimum height or use viewport units:
Messages not received
Messages not received
Solution: Ensure you’re listening before creating the session:
Best practices
Next steps
Error handling
Handle payment errors gracefully
Payment methods
Discover available payment options
Testing
Test iframe integration
Webhooks
Process server-side events