1. Go to this page and download the library: Download unipago/api-sdk-php 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/ */
unipago / api-sdk-php example snippets
/**
* Carregando o autoload
*/
UnipagoApi\Connection;
/**
* Aqui devem ser informados seu client_id e client_secret
* que podem ser gerados no Unipago
*/
$client_id = 'CLIENT_ID';
$client_secret = 'CLIENT_SECRET';
/**
* Deve ser informado o ambiente que deseja utilizar Connection::SCOPE_SANDBOX
* ou Connection::SCOPE_PRODUCTION
*/
$conexao = new Connection(Connection::SCOPE_SANDBOX, $client_id, $client_secret);
echo "<pre>Access_token: <br />";
print_r($conexao->accessToken);
echo "</pre>";
/**
* Carregando o autoload
*/
UnipagoApi\Connection;
use UnipagoApi\Resource;
/**
* Aqui devem ser informados seu client_id e client_secret
* que podem ser gerados no Unipago
*/
$client_id = 'SEU CLIENT ID';
$client_secret = 'SEU CLIENT SECRET';
/**
* Deve ser informado o ambiente que deseja utilizar Connection::SCOPE_SANDBOX
* ou Connection::SCOPE_PRODUCTION
*/
$conexao = new Connection(Connection::SCOPE_SANDBOX, $client_id, $client_secret);
/**
* Instância do recurso de Cliente que será utilizada, onde deve ser passada a conexão
*/
$recursoCliente = new Resource\Cliente($conexao);
/**
* Retorna todos os clientes cadastrados no formato JSON
*/
$clientes = $recursoCliente->listar();
print_r($clientes);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.