potelo / inter-php
Banco Inter PHP Library
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 3
Forks: 0
Open Issues: 1
pkg:composer/potelo/inter-php
Requires
- php: >=7.4.0
- ext-json: *
- guzzlehttp/guzzle: ^7.5.0
This package is auto-updated.
Last update: 2025-10-29 03:33:48 UTC
README
The Banco Inter PHP client provides convenient access to the Banco Inter API from applications written in the PHP language.
Other languages
Requirements
PHP 7.4.0 and later.
Composer
You can install the package via Composer. Run the following command:
composer require potelo/inter-php
Or simply add it to your composer.json dependences and run composer update:
"require": { "potelo/inter-php": "dev-main" }
To use the client, use Composer's autoload:
require_once 'vendor/autoload.php';
Dependencies
The library require the following extensions in order to work properly:
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.
Usage
Getting Authorization doc
$privateKey = 'you-private-key-path.key'; $certificate = 'you-certificate-path.crt'; $clientId = 'you-client-id'; $clientSecret = 'your-client-secret'; $client = new \Potelo\InterPhp\InterClient($privateKey, $certificate, $clientId, $clientSecret); $scopes = ['cob.read']; $client->authorize($scopes);
You can get new token with new scopes using the same client instance:
$scopes = ['cob.read', 'cob.write', 'pix.read', 'pix.write']; $client->authorize($scopes);
Bank Slip Charge API
get doc
Get a Bank Slip.
$bankSlip = $client->bankSlipApi()->get('bank-slip-our-number'); print_r($bankSlip);
getPdf doc
Get a Bank Slip PDF.
$bankSlip = $client->bankSlipApi()->getPdf('bank-slip-our-number'); print_r($bankSlip);
create doc
Create a Bank Slip.
$yorNumber = "your-number"; $dueDate = new \DateTime('2023-03-31'); $payer = new Payer("cpf number", "FISICA", "Payer Name", "Address", "Salvador", "BA", "41000000"); $bankSlip = $this->client->bankSlipApi()->create($yorNumber, 10.90, $dueDate, 0, $payer); print_r($bankSlip);
list doc
Get a list of Bank Slips in a period.
$after = new \DateTime('2023-03-31'); $before = new \DateTime('2023-03-31'); $bankSlips = $this->client->bankSlipApi()->list($after, $before); print_r($bankSlips);
Other filters
You can pass an array of filters to the list method.
$after = new \DateTime('2023-03-31'); $before = new \DateTime('2023-03-31'); $filters = [ 'filtrarDataPor' => 'VENCIMENTO', ]; $bankSlips = $this->client->bankSlipApi()->list($after, $before, $filters); print_r($bankSlips);
summary doc
Get a summary of a list of Bank Slips.
$after = new \DateTime('2023-03-31'); $before = new \DateTime('2023-03-31'); $summary = $this->client->bankSlipApi()->summary($after, $before); print_r($summary);
cancel doc
Cancel a Bank Slip.
$cancelReason = "APEDIDODOCLIENTE"; $this->client->bankSlipApi()->cancel('bank-slip-our-number', $cancelReason);
Immediate Charge Pix API
get doc
Get an Immediate Charge by transaction id.
$immediateCharge = $client->immediateChargeApi()->get('your-immediate-charge-txid'); print_r($immediateCharge);
create doc
Create an Immediate Charge.
$amount = 12.50; $pixKey = 'your-pix-key'; $expiry = 3600; // seconds $data = [ "devedor" => [ "cpf" => "01234567891", "nome" => "John Doe" ], "loc" => [ "tipoCob" => "cob" ], "solicitacaoPagador" => " ", "infoAdicionais" => [ [ "nome" => "Product", "valor" => "cool pajamas" ] ] ]; $immediateCharge = $client->immediateChargeApi()->create($pixKey, $amount, $expiry, $data); print_r($immediateCharge);
createAs doc
Create an Immediate Charge specifying a unique transaction id.
$txId = 'your-unique-transaction-id'; $amount = 12.44; $pixKey = 'your-pix-key'; $secondsToExpiry = 3600; $data = [ "devedor" => [ "cpf" => "01234567891", "nome" => "John Doe" ], "loc" => [ "tipoCob" => "cob" ], "solicitacaoPagador" => " ", "infoAdicionais" => [ [ "nome" => "Product", "valor" => "cool pajamas" ] ] ]; $immediateCharge = $client->immediateChargeApi()->createAs($txId, $pixKey, $amount, $secondsToExpiry, $data); print_r($immediateCharge);
update doc
Update an Immediate Charge.
$data = [ "valor" => 22.50 ]; $immediateCharge = $client->immediateChargeApi()->update('immediate-charge-txid', $data); print_r($immediateCharge);
list doc
Get a list of Immediate Charges in a period.
$after = new \DateTime('2023-03-01T00:00:00-03:00'); $before = new \DateTime('2023-03-23T23:59:00-03:00'); $immediateCharges = $client->immediateChargeApi()->list($after, $before); print_r($immediateCharges);
Other filters
You can pass an array of filters to the list method.
$after = new \DateTime('2023-03-01T00:00:00-03:00'); $before = new \DateTime('2023-03-23T23:59:00-03:00'); $filters = [ 'cpf' => '01234567891', ]; $immediateCharges = $client->immediateChargeApi()->list($after, $before, $filters); print_r($immediateCharges);
Pix Pix API
get doc
Get a Pix by transaction id.
$pix = $client->pixApi()->get('pix-endToEndId'); print_r($pix);
list doc
Get a list of Pix in a period.
$after = new \DateTime('2023-03-01T00:00:00-03:00'); $before = new \DateTime('2023-03-23T23:59:00-03:00'); $pixList = $client->immediateChargeApi()->list($after, $before); print_r($pixList);
returnPix doc
Return a Pix.
$id = 'your-unique-id'; $amountToReturn = 12.44; $pix = $client->pixApi()->returnPix('pix-endToEndId', $id, $amountToReturn); print_r($pix);
getReturnPix doc
Get a Pix return.
$id = 'your-unique-id'; $pix = $client->pixApi()->getReturnPix('pix-endToEndId', $id); print_r($pix);
API Documentation
The Banco Inter API documentation can be found here.