Skip to main content

Prerequisites

Requirements:
  • Modern web browser with ES6 support
  • API token from your Payviox dashboard
  • Node.js 14+ (for npm installation)

Installation methods

You can integrate the Payviox SDK using different methods depending on your project setup.
  • CDN
  • NPM
  • Download
Include the SDK directly in your HTML file using a CDN link.
index.html
<!DOCTYPE html>
<html>
<head>
  <title>Payviox Integration</title>
</head>
<body>
  <!-- Your content -->
  
  <script src="https://cdn.payviox.com/sdk/payviox.js"></script>
  <script>
    // The SDK is now globally available
    const payviox = new Payviox('your_api_token');
  </script>
</body>
</html>
Using the CDN is the fastest way to get started and automatically provides updates.

Get your API token

To use the SDK, you need an API token from your Payviox dashboard.
1

Log in to your dashboard

Navigate to https://dash.payviox.com and sign in with your credentials.
2

Access API settings

Go to Settings > API Keys in the sidebar menu.
3

Create or copy token

Click Create new API key or copy an existing key.
Never expose your API token in client-side code in production. Use it only for server-side operations or in secure environments.

Initialize the SDK

Once installed, initialize the SDK with your API token:
const payviox = new Payviox('your_api_token');

// Verify that initialization is successful
console.log('Payviox SDK initialized');

Verify installation

Test your installation by fetching available payment methods:
test.js
const payviox = new Payviox('your_api_token');

// Test the API connection
payviox.getPaymentsMethods()
  .then(methods => {
    console.log('Available payment methods:', methods);
  })
  .catch(error => {
    console.error('Installation error:', error);
  });
If you see a list of payment methods in the console, your SDK is correctly installed and configured.

Environment configuration

Development vs Production

Use different API tokens for development and production environments:
config.js
const PAYVIOX_TOKEN = process.env.NODE_ENV === 'production'
  ? 'pk_live_xxxxxxxxxxxxx'
  : 'pk_test_xxxxxxxxxxxxx';

const payviox = new Payviox(PAYVIOX_TOKEN);

Base URL configuration

The SDK automatically uses the correct base URLs:
  • API endpoint: https://api.payviox.com
  • Secure redirect: https://secure.payviox.com
These URLs are managed internally by the SDK and cannot be modified in standard configurations.

Next steps