Skip to main content

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.
Domain whitelisting required: Your domain must be whitelisted in your Payviox dashboard settings to use iframe mode.

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

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 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.

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:
Always validate event.origin against https://secure.payviox.com before acting on any message.

Troubleshooting

Possible causes:
  • Domain not whitelisted
  • Invalid iframe target element
  • Content Security Policy blocking iframe
Solution:
Solution: Set a fixed minimum height or use viewport units:
Solution: Ensure you’re listening before creating the session:

Best practices

Recommended practices for iframe integration:
  1. Provide visual feedback: Show loading states while the iframe loads
  2. Handle errors gracefully: Display user-friendly messages for errors
  3. Mobile optimization: Test on various screen sizes
  4. Accessibility: Ensure keyboard navigation works properly
  5. Performance: Initialize iframes only when needed (lazy loading)

Next steps

Error handling

Handle payment errors gracefully

Payment methods

Discover available payment options

Testing

Test iframe integration

Webhooks

Process server-side events