marcioar / php-pix-bacen
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.16
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2024-09-06 06:45:37 UTC
README
A API Pix padroniza serviços oferecidos pelo PSP recebedor no contexto do arranjo Pix, como criação de cobrança, verificação de Pix recebidos, devolução e conciliação. Os serviços expostos pelo PSP recebedor permitem ao usuário recebedor estabelecer integração de sua automação com os serviços Pix do PSP. # Evolução da API Pix As seguintes mudanças são esperadas e consideradas retro-compatíveis (backwards-compatibility): - Adição de novos recursos na API Pix. - Adição de novos parâmetros opcionais a cobranças. - Adição de novos campos em respostas da API Pix. - Alteração da ordem de campos. - Adição de novos elementos em enumerações Mudanças compatíveis não geram nova versão da API Pix. Clientes devem estar preparados para lidar com essas mudanças sem quebrar. Mudanças incompatíveis geram nova versão da API Pix.
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 2.1.2
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen For more information, please visit https://www.bcb.gov.br/estabilidadefinanceira/pagamentosinstantaneos
Requirements
PHP 5.5 and later
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/marcioarp/php-pix-bacen.git"
}
],
"require": {
"marcioarp/php-pix-bacen": "main"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php
:
require_once('/path/to/php-pix-bacen/vendor/autoload.php');
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: OAuth2 $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Swagger\Client\Api\CobApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $inicio = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | $fim = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | $cpf = "cpf_example"; // string | $cnpj = "cnpj_example"; // string | $location_presente = true; // bool | $status = "status_example"; // string | $paginacao_pagina_atual = 0; // int | $paginacao_itens_por_pagina = 100; // int | try { $result = $apiInstance->cobGet($inicio, $fim, $cpf, $cnpj, $location_presente, $status, $paginacao_pagina_atual, $paginacao_itens_por_pagina); print_r($result); } catch (Exception $e) { echo 'Exception when calling CobApi->cobGet: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: OAuth2 $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Swagger\Client\Api\CobApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Swagger\Client\Model\CobSolicitada(); // \Swagger\Client\Model\CobSolicitada | Dados para geração da cobrança imediata. try { $result = $apiInstance->cobPost($body); print_r($result); } catch (Exception $e) { echo 'Exception when calling CobApi->cobPost: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: OAuth2 $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Swagger\Client\Api\CobApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $txid = new \Swagger\Client\Model\TxId(); // \Swagger\Client\Model\TxId | $revisao = new \Swagger\Client\Model\Revisao(); // \Swagger\Client\Model\Revisao | try { $result = $apiInstance->cobTxidGet($txid, $revisao); print_r($result); } catch (Exception $e) { echo 'Exception when calling CobApi->cobTxidGet: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: OAuth2 $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Swagger\Client\Api\CobApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Swagger\Client\Model\CobRevisada(); // \Swagger\Client\Model\CobRevisada | Dados para geração da cobrança. $txid = new \Swagger\Client\Model\TxId(); // \Swagger\Client\Model\TxId | try { $result = $apiInstance->cobTxidPatch($body, $txid); print_r($result); } catch (Exception $e) { echo 'Exception when calling CobApi->cobTxidPatch: ', $e->getMessage(), PHP_EOL; } // Configure OAuth2 access token for authorization: OAuth2 $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Swagger\Client\Api\CobApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Swagger\Client\Model\CobSolicitada(); // \Swagger\Client\Model\CobSolicitada | Dados para geração da cobrança imediata. $txid = new \Swagger\Client\Model\TxId(); // \Swagger\Client\Model\TxId | try { $result = $apiInstance->cobTxidPut($body, $txid); print_r($result); } catch (Exception $e) { echo 'Exception when calling CobApi->cobTxidPut: ', $e->getMessage(), PHP_EOL; } ?>
Documentation for API Endpoints
All URIs are relative to https://pix.example.com/api/v2/
Documentation For Models
- AbatimentoAplicado
- AllOfCobVValorDesconto
- AllOfCobsConsultadasCobsItems
- AllOfCobsVConsultadasCobsItems
- AllOfDadosDevedorDevedor
- AllOfDadosRecebedorRecebedor
- AllOfLotesCobVConsultadosLotesItems
- AllOfPayloadLocationConsultadasLocItems
- AllOfPixConsultadosPixItems
- AllOfWebhooksConsultadosWebhooksItems
- CobApresentacao
- CobBase
- CobBaseInfoAdicionais
- CobCompleta
- CobCriacao
- CobDataDeVencimento
- CobExpiracao
- CobGerada
- CobPayload
- CobPayloadValor
- CobRevisada
- CobSolicitada
- CobVCompleta
- CobVGerada
- CobVPayload
- CobVPayloadValor
- CobVRevisada
- CobVSolicitada
- CobVValor
- CobValor
- CobsConsultadas
- CobsVConsultadas
- DadosComplementaresPessoa
- DadosDevedor
- DadosRecebedor
- Devolucao
- DevolucaoHorario
- DevolucaoId
- DevolucaoSolicitada
- EndToEndId
- JuroAplicado
- LoteCobVConsultado
- LoteCobVConsultadoCobsv
- LoteCobVGerado
- LotesCobVConsultados
- MultaAplicada
- Paginacao
- ParametrosConsultaCob
- ParametrosConsultaLote
- ParametrosConsultaPayloadLocation
- ParametrosConsultaPix
- ParametrosConsultaWebhooks
- PayloadLocation
- PayloadLocationCob
- PayloadLocationCompleta
- PayloadLocationConsultadas
- PayloadLocationId
- PayloadLocationSolicitada
- PessoaFisica
- PessoaJuridica
- Pix
- PixConsultados
- Revisao
- TxId
- WebhookCompleto
- WebhookSolicitado
- WebhooksConsultados
Documentation For Authorization
OAuth2
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
- ****: