1. Go to this page and download the library: Download jlamim/banpay-php-sdk 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/ */
jlamim / banpay-php-sdk example snippets
$cliente = new Cliente;
$cliente->setToken("TOKEN");
$cliente->setEnvironment('homologacao');
use BanPay\Cliente;
use BanPay\Services\Consultas\Usuario;
use BanPay\Exceptions\BanPayException;
$cliente = new Cliente;
$cliente->setToken("TOKEN");
try{
$usuario = Usuario::get($cliente);
echo $usuario->getNome();
echo $usuario->getApelido();
echo $usuario->getEmail();
}catch(BanPayException $e){
echo $e->getMessage();
}
use BanPay\Cliente;
use BanPay\Services\Consultas\Saldo;
use BanPay\Exceptions\BanPayException;
$cliente = new Cliente;
$cliente->setToken("TOKEN");
try{
$saldo = Saldo::get($cliente);
echo $saldo->getUsuario();
echo $saldo->getEmail();
echo $saldo->getSaldoDisponivel();
}catch(BanPayException $e){
echo $e->getMessage();
}
use BanPay\Cliente;
use BanPay\Services\Consultas\Transferencia;
use BanPay\Exceptions\BanPayException;
$cliente = new Cliente;
$cliente->setToken("TOKEN");
$codigo = "xxxxxxxx";
try{
$transferencia = Transferencia::get($cliente, $codigo);
echo $transferencia->getData();
echo $transferencia->getValor();
echo $transferencia->getOrigem();
echo $transferencia->getOrigemUsuario();
echo $transferencia->getOrigemNome();
echo $transferencia->getOrigemEmail();
echo $transferencia->getDestinoUsuario();
echo $transferencia->getDestinoNome();
echo $transferencia->getDestinoEmail();
// retorna a data pra ser usada com a biblioteca https://carbon.nesbot.com/
$transferencia->getDataCarbon();
}catch(BanPayException $e){
echo $e->getMessage();
}
use BanPay\Cliente;
use BanPay\Services\Financeiro\NovaTransferencia;
use BanPay\Services\Financeiro\Transferencia;
use BanPay\Exceptions\BanPayException;
$cliente = new Cliente;
$cliente->setToken("TOKEN");
$transferencia = new Transferencia;
$transferencia->setContaDestino('[email protected]');
$transferencia->setValor(100.99);
try{
$novaTransferencia = new NovaTransferencia;
$resposta = $novaTransferencia->executar($cliente, $transferencia);
echo $resposta->getStatus();
echo $resposta->getHashTransacao();
echo $resposta->getMensagem();
}catch(BanPayException $e){
echo $e->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.