PHP code example of ae8 / contaazul

1. Go to this page and download the library: Download ae8/contaazul library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ae8 / contaazul example snippets


$
use AE8\ContaAzul\ContaAzul;
use AE8\ContaAzul\Helpers\Helpers;

// Variáveis necessárias para inicialização
$client_id = "CLIENT_ID";
$client_secret = "SECRET_ID";
$redirect_uri = "URL_DE_REDIRECIONAMENTO";
$scope = "sales";
$state = Helpers::generateRandomString(16);

// Instanciando a classe
$apiContaazul = new ContaAzul($client_id, $client_secret, $redirect_uri, $scope, $state);

if (isset($_REQUEST['code'])) {
    $getToken = $apiContaazul->requestToken($_REQUEST['code']);
}

$getToken = $apiContaazul->requestToken($refresh_token);

$request = $apiContaazul->request($endpoint, $parametros, $token, $metodo);