Initial configuration of Transparent Checkout

This document provides instructions on how to use the "aqpago.min.js" script provided by AQBank to obtain session data related to a transaction. With this data, we can validate the authenticity of a specific transaction.

The "aqpago.min.js" script offers two main functions: setPublicToken and getSessionID. Follow the steps below to use them:


1. Loading the Script

Make sure the script is loaded in your environment. Add the tag to your HTML page:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Page</title>

    <!-- Loading the aqpago.min.js script -->
    <script defer="defer" src="https://cdn.aqbank.com.br/js/aqpago.min.js"></script>
</head>
<body>
    <!-- Body of your page -->
</body>
</html>

2. Setting up the Token

Before calling the getSessionID function, you need to set up the public token using the setPublicToken function. The token is essential for generating the session. It is obtained during the Authentication of the API in the "fingerprint" parameter.

With the parameters set, we can generate the session_id. Example:

// Setting up the public token
AQPAGOSECTION.setPublicToken("{$YOUR_TOKEN_HERE}");

Replace 'YOUR_TOKEN_HERE' with the fingerprint provided every time you authenticate via the API.


3. Obtaining the session_id

After setting up the token, you can call the getSessionID function to obtain the session_id. This function can be called in response to an event, such as a button click, or at another point in your code. Example:

// Obtaining the session_id after setting up the token
var AQPAGOSECTION.getSessionID();
console.log('session_id:', sessionID);

The session_id will be available for use after the successful call to the getSessionID function.