marcioar/php-pix-bacen

dev-main 2020-11-18 08:36 UTC

This package is auto-updated.

Last update: 2024-09-06 06:45:37 UTC


README

A API Pix 标准化了接收方支付服务提供商(PSP)在 Pix 生态系统内提供的服务,如创建收款、验证接收到的 Pix、退款和结算。接收方 PSP 提供的服务允许用户接收方与其自动化系统与 PSP 的 Pix 服务集成。# API Pix 的演进 以下变更预计是向后兼容的(向后兼容):- 在 API Pix 中添加新功能。 - 向收款添加新可选参数。 - 在 API Pix 响应中添加新字段。 - 修改字段顺序。 - 在枚举中添加新元素。这些兼容性变更不会生成 API Pix 的新版本。客户应准备处理这些变更而不会破坏。不兼容的变更将生成 API Pix 的新版本。

此 PHP 包是由 Swagger Codegen 项目自动生成的

要求

PHP 5.5 及以上

安装 & 使用

Composer

要通过 Composer 安装绑定,请将以下内容添加到 composer.json

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/marcioarp/php-pix-bacen.git"
    }
  ],
  "require": {
    "marcioarp/php-pix-bacen": "main"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

    require_once('/path/to/php-pix-bacen/vendor/autoload.php');

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门指南

请按照 安装说明 进行操作,然后运行以下命令

<?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;
}
?>

API 端点文档

所有 URI 都是相对于 https://pix.example.com/api/v2/

模型文档

授权文档

OAuth2

  • 类型: OAuth
  • 流程:应用
  • 授权URL:
  • 作用域:
  • ****:

作者

suporte.ti@bcb.gov.br