Skip to main content
Manually redirects the user to the payment page for a given session ID.
openSession(sessionId: string): void

Parameters

sessionId
string
required
The session ID returned from createSession().
const sessionId = 'ses_abc123...';
payviox.openSession(sessionId);

Examples

const payviox = new Payviox('your_api_token');

// Create a session
const sessionId = await payviox.createSession({
  amount: 5000,
  currency: 'USD',
  customer: 'user@example.com',
  description: 'Order payment',
  paymentMethodId: 'pm_card',
  order_id: 'order_123',
  items: [{ name: 'Product', quantity: 1, price: 5000 }]
});

// Perform other actions...
console.log('Session ready:', sessionId);

// Redirect when ready
payviox.openSession(sessionId);
Use this method when you need to perform actions between session creation and redirection.