marcioarp / php-pix-bacen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php-pix-bacen

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:

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/

Class Method HTTP request Description
CobApi cobGet GET /cob Consultar lista de cobranças imediatas.
CobApi cobPost POST /cob Criar cobrança imediata.
CobApi cobTxidGet GET /cob/{txid} Consultar cobrança imediata.
CobApi cobTxidPatch PATCH /cob/{txid} Revisar cobrança imediata.
CobApi cobTxidPut PUT /cob/{txid} Criar cobrança imediata.
CobPayloadApi cobvPixUrlAcessTokenGet GET /cobv/{pixUrlAcessToken} Recuperar o payload JSON que representa a cobrança com vencimento.
CobPayloadApi pixUrlAcessTokenGet GET /{pixUrlAcessToken} Recuperar o payload JSON que representa a cobrança imediata.
CobVApi cobvGet GET /cobv Consultar lista de cobranças com vencimento.
CobVApi cobvTxidGet GET /cobv/{txid} Consultar cobrança com vencimento.
CobVApi cobvTxidPatch PATCH /cobv/{txid} Revisar cobrança com vencimento.
CobVApi cobvTxidPut PUT /cobv/{txid} Criar cobrança com vencimento.
LoteCobVApi lotecobvGet GET /lotecobv Consultar lista de lotes de cobranças com vencimento.
LoteCobVApi lotecobvIdGet GET /lotecobv/{id} Consultar lote de cobranças com vencimento.
LoteCobVApi lotecobvIdPut PUT /lotecobv/{id} Criar lote de cobranças com vencimento.
PayloadLocationApi locGet GET /loc Consultar locations cadastradas.
PayloadLocationApi locIdGet GET /loc/{id} Recuperar location do payload.
PayloadLocationApi locIdTxidDelete DELETE /loc/{id}/txid Desvincular um txid de uma location.
PayloadLocationApi locPost POST /loc Criar location do payload.
PixApi pixE2eidDevolucaoIdGet GET /pix/{e2eid}/devolucao/{id} Consultar devolução.
PixApi pixE2eidDevolucaoIdPut PUT /pix/{e2eid}/devolucao/{id} Solicitar devolução.
PixApi pixE2eidGet GET /pix/{e2eid} Consultar Pix.
PixApi pixGet GET /pix Consultar Pix recebidos.
WebhookApi webhookChaveDelete DELETE /webhook/{chave} Cancelar o webhook Pix.
WebhookApi webhookChaveGet GET /webhook/{chave} Exibir informações acerca do Webook Pix.
WebhookApi webhookChavePut PUT /webhook/{chave} Configurar o Webhook Pix.
WebhookApi webhookGet GET /webhook Consultar webhooks cadastrados.

Documentation For Models

Documentation For Authorization

OAuth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
  • ****:

Author

suporte.ti@bcb.gov.br

About


Languages

Language:PHP 99.9%Language:Shell 0.1%