Skip to main content
Creates a new payment session and optionally redirects or embeds an iframe.

Parameters

SessionParameters
required
Object containing payment session details.
PayvioxParameters
Optional configuration for integration mode and behavior.

Return value

Promise<void | string>
Returns a Promise that resolves to:
  • void when using redirect: true (page redirects before returning)
  • string (session ID) in all other cases

Direct Redirect (Skip Payment Page)

When you specify a paymentMethodId for a redirect-based payment provider (like Zen, Nicepay, PayPal, etc.), the SDK will automatically redirect the customer directly to the payment provider, bypassing the Payviox payment page entirely.
This feature works automatically when using redirect: true or iframeMode: true with a redirect-based provider.

How it works

  1. You call createSession() with a paymentMethodId for a redirect-based provider
  2. The API creates the session and initiates the payment in one call
  3. The SDK receives a redirect_url in the response
  4. The customer is redirected directly to the provider’s payment page

Example with Direct Redirect

Supported Providers

Direct redirect works with these providers:
  • Zen (zen_card, zen_blik, etc.)
  • Nicepay (nicepay_va, nicepay_ewallet, etc.)
  • PayPal (paypal)
  • Payssion (various local payment methods)
  • Pallapay (crypto payments)
  • Crypto.com (cryptocom)
If you don’t specify a paymentMethodId, or use a non-redirect provider, the standard flow applies (redirect to Payviox payment page).

Handling Errors

If the payment initiation fails, the SDK will fall back to the standard Payviox payment page where the customer can try again or choose another payment method.

Examples

Error handling