First steps - Web

This page provides a comprehensive guide to initializing the DEUNA Web SDK in your application.

📘

Stable version: 1.6

Requirements

To use the DEUNA Web SDK, you must have:

  • Knowledge of web development with JavaScript.
  • An active account at DEUNA.
  • Valid DEUNA credentials.
📘

If you experience any delays in obtaining your credentails, please contact [email protected].

Install the Web SDK

Web SDK initialization begins.

🚧

Follow security and privacy practices when handling user financial information.

1. Add the DEUNA Web SDK to your project

Load our SDK via the official URL for the desired environment.

📘

The DEUNA Web SDK can only be installed via CDN.

The attributecrossorigin provides support for CORS defining how the script element handles cross-origin calls.

Add the following script to your HTML file:

<script crossorigin  src="https://cdn.deuna.io/web-sdk/v1.6/index.js"></script>

You can also add the DEUNA SDK dynamically using JavaScript.

Example

if (typeof DeunaSDK === "undefined") { // si el SDK de DEUNA aun no se encuentra agregado
    var script = document.createElement("script");
    script.src = "https://cdn.deuna.io/web-sdk/v1.6/index.js";
    script.onload = function() {
       // Initicializar el SDK de DEUNA y
       // mostrar un widget
    };
    document.head.appendChild(script);
} else {
    //  mostrar un widget
}

2. Initialize the SDK

Create an instance of the class DeunaSDK:

await DeunaSDK.initialize({
  publicApiKey: "YOUR_PUBLIC_API_KEY", // Llave pública proporcionada por DEUNA
  env: "sandbox",// Ambiente de pruebas (sandbox) o producción (production)
});

3. Choose the widget component

Continue the integration process following the specific instructions for each component.

Choose the component:

Content Security Policy (CSP) whitelisting

If your website uses a Content Security Policy (CSP), you must whitelist the following DEUNA URLs to ensure the Web SDK works properly. If your website does not use CSP, you can skip this section.

Fraud prevention services

These URLs are required for automatic anti-fraud credential configuration:

EnvironmentURL
Productionhttps://api-f.deuna.io
Sandboxhttps://api-f.sbx.deuna.io

DEUNA API

These URLs are required for core API communication:

EnvironmentURL
Productionhttps://apigw.getduna.com
Sandboxhttps://api.sandbox.deuna.io

Example CSP header

Below is an example of how to add DEUNA domains to your CSP header:

Content-Security-Policy: connect-src 'self' https://api-f.deuna.io https://apigw.getduna.com;

For sandbox environments:

Content-Security-Policy: connect-src 'self' https://api-f.sbx.deuna.io https://api.sandbox.deuna.io;
⚠️

Make sure to include both the fraud prevention and API URLs for your target environment. Missing any of these URLs may result in degraded functionality, such as failed payments or anti-fraud configuration errors.