Overview
Redirect mode redirects your customers to a Payviox-hosted payment page where they complete their payment. This is the simplest and most secure integration method.Redirect mode is recommended for:
- Quick integrations
- Maximum PCI compliance
- When you don’t need custom payment UI
How it works
1
Create payment session
Your application creates a payment session with customer and order details.
2
Redirect to Payviox
Customer is redirected to the secure Payviox payment page using the session ID.
3
Customer completes payment
Customer enters their payment information on the Payviox-hosted page.
4
Return to your site
After payment, customer is redirected back to your specified URL with the payment result.
Implementation
Example with automatic redirect
payment.js
Session parameters
ThecreateSession() method accepts two parameter objects:
Payment session details (SessionParameters)
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | number | ✅ Required | Payment amount in the smallest currency unit (cents for USD). Example: 5000 = 1.00). |
currency | string | ✅ Required | Three-letter ISO currency code. Example: 'USD', 'EUR', 'GBP' |
customer | string | ✅ Required | Customer identifier. Can be an email, customer ID, or any unique identifier. Example: 'customer_abc123' or 'user@example.com' |
description | string | ✅ Required | Human-readable description of the payment. Example: 'Premium subscription - Monthly' |
paymentMethodId | string | ✅ Required | Payment method identifier. Use 'pm_card' for card payments. Get available methods with getPaymentsMethods(). |
order_id | string | ✅ Required | Unique identifier for this order. Must be unique across all your transactions. Example: 'order_2024_001' or 'order_' + Date.now() |
items | array | ✅ Required | Array of items being purchased. Each item must contain: name (string), quantity (number), price (number in cents). |
Integration options (PayvioxParameters)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
redirect | boolean | ⚪ Optional | false | If true, automatically redirects to the payment page. Cannot be used with iframeMode: true. |
iframeMode | boolean | ⚪ Optional | false | If true, embeds the payment form in an iframe. Requires iframeConfig to be set. Cannot be used with redirect: true. |
iframeConfig | object | ⚪ Optional | - | Configuration for iframe mode. Required when iframeMode is true. See iframe integration documentation for details. |
Item object structure
Each item in theitems array must have:
| Property | Type | Required | Description |
|---|---|---|---|
name | string | ✅ Required | Name or description of the item |
quantity | number | ✅ Required | Quantity being purchased. Must be a positive integer. |
price | number | ✅ Required | Unit price in the smallest currency unit (cents). |
Return value
ThecreateSession() method returns a Promise that resolves to:
voidwhen usingredirect: true(page redirects before returning)string(session ID) in all other cases
Best practices
Validate payment parameters
Validate payment parameters
Always validate payment parameters on your server before creating sessions:
Handle network errors gracefully
Handle network errors gracefully
Implement retry logic for transient failures: