Endpoints

On this page you will find all available endpoints of the Gerencianet Payment API. We recommend that you join our community in Discord to keep up with api developments, including the release of new endpoints.

Use the summary below to quickly navigate between api endpoint groups.

Base routes

Base route or base URL's for environments, use the route below to communicate your application with the production environment offered by Gerencianet.

"URL": {
"Production": "https://apis.gerencianet.com.br/"
}

Get authorization

POST/oauth/token

This endpoint is used to authorize an application's credentials and get the scopes that the application has to access the other API endpoints. The P12/PEM certificate must be present in the authorization request for the handshake with the API server to be allowed.

Examples of authorization using the certificate. P12

To use the Gerencianet Payment API, the client and server must communicate on a verified connection to each other. Verification is done by the two-way certificate (.PEM or .P12), that is, the server and client have implemented a private key certificate and a public key certificate that allows one to ensure the identity of the other.

Therefore to make any HTTP request to the Payments API, including the authorization request with OAuth2, it is necessary the certificate .P12, or .pem, in the request headers.

Below are examples of how to consume the Authorization of the Gerencianet Payment API by incorporating this certificate into the request.

<?php //Desenvolvido pela Consultoria Técnica da Gerencianet
$config = [
"certificado" => "./certificado.pem",
"client_id" => "YOUR-CLIENT-ID",
"client_secret" => "YOUR-CLIENT-SECRET"
];
$autorizacao = base64_encode($config["client_id"] . ":" . $config["client_secret"]);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://apis.gerencianet.com.br/oauth/token", // Rota base, homologação ou produção
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => '{"grant_type": "client_credentials"}',
CURLOPT_SSLCERT => $config["certificado"], // Caminho do certificado
CURLOPT_SSLCERTPASSWD => "",
CURLOPT_HTTPHEADER => array(
"Authorization: Basic $autorizacao",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo "<pre>";
echo $response;
echo "</pre>";

Authorization example of response
The code snippet below represents an example of OAuth's response to your authorization request.
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "gn.barcode.read gn.barcode.pay.write gn.barcode.pay.read"
}

Payments

Getting the barcode to pay

GET/pagamento/codBarras/:codBarras

This endpoint should be used to get the information linked to a barcode of any type of billing. The use of this endpoint is mandatory before making a payment, as it helps prevent errors in processing.

Important

There are two types of charges and they can return different information. Are they:

  1. Tribute type – also known as bonds and agreements, this type of charge is issued by services such as: water, electricity, telephone and gas bills. They are not registered with the "Câmara Interbancária de Pagamento" (CIP) and, therefore, do not return the same information that a boleto registered with the CIP presents.

  2. Boleto type – registered with the "Câmara Interbancária de Pagamento" (CIP) and, therefore, after being consulted, the endpoint returns more complete information about the payment.

In the item “Responses”, below, you can check the return of the queries of each type of charge.

Requires authorization for the scope: gn.barcode.read

Request
This endpoint uses query params in its operation, so they must be sent via the URL, as exemplified in the code snippet below.

/pagamento/codBarras/:codBarras

Parameters Definition

AttributeDescriptionRequiredType
codBarrasCharge barcode, this code can also be the typeable line returned via API by the 'barcode'.yesString
Response
The answers below represent Success and Failures of consumption.
{{
"tipo": "boleto",
"banco": {
"codigo": 364,
"nome": "Gerencianet S.A."
},
"codBarras": "0000000000000000000000000000000000",
"linhaDigitavel": "000000000000000000000000000000000",
"datas": {
"vencimento": "2021-06-22 14:23:42",
"limitePagamento": "2021-09-22 14:23:42"
},
"beneficiario": {
"nome": "João da Silva",
"fantasia": "Padaria do João",
"documento": "00000000000000"
},
"pagador": {
"nome": "Gorbadock Oldbuck",
"documento": "00000000000"
},
"valores": {
"original": 1000,
"abatimento": 0,
"multa": 200,
"juros": 2,
"desconto": 300,
"final": 902
},
"informacoesPagamento": {
"divergente": {
"deveAceitar": false,
"valorMinimo": 0,
"valorMaximo": 0
},
"parcial": {
"deveAceitar": false,
"limiteDePagamentos": 0
},
"podeSerPago": true
}
}

Request barcode payment

POST/pagamento/codBarras/:codBarras

This endpoint should be used to request payment for a barcode for the current or future date.

Important

Barcode payments are accepted until 10pm. Tax payments and bills (water, energy, cable TV, gas and telephone) are until 6pm.

Requires the scope: gn.barcode.pay.write

Request
This endpoint uses query params, so they should be sent by the URL, as exemplified in the code snippet below.

/pagamento/codBarras/:codBarras
Request body
{
"valor": 500,
"dataPagamento": "2022-03-10",
"descricao": "Pagamento de boleto, teste API Pagamentos"
}

Params definition

AttributeDescriptionRequiredType
codBarrasbarcode of the bill that is about to pay.yesString
dataPagamentoPayment due date.yesstring. In the format YYYY-MM-DD
valorCharge amount.yesInteger. Value in BRL cents. Ex: R$10,00 = 1000
descricaopayment description.noString
Response
The answers below represent Success and Consumption Failures.
{
"idPagamento": "31234652",
"valorPago": 500,
"status": "LIQUIDADO",
"data": {
"solicitacao": "2021-06-22 14:23:42",
"pagamento": "2021-06-25 13:03:20"
}
}


Get payment request

GET/pagamento/:idPagamento

Check the status of the payment request previously using the idPagamento.

Requires the scope: gn.barcode.pay.read

Request
This endpoint uses query params, so they should be sent by the URL, as exemplified in the code snippet below.

/pagamento/:idPagamento

Params definition

AttributeDescriptionRequiredType
idPagamentoId generated in the payment requestyesString
statusThe status field represents the status of the requested payment. It can assume the following states:
EM_PROCESSAMENTO - (processing) The payment request has been received and is being processed.
AGENDADO - (scheduled) Payment was scheduled to be made on the requested date.
REALIZADO - (done) Payment has been successfully sent to be settled.
LIQUIDADO - (settled) Payment has been successfully settled.
CANCELADO - (canceled) The payment was canceled and the amount refunded.
NAO_REALIZADO - (not done) The payment had an error and was not sent for settlement.
noString
Response
The answers below represent Success and Consumption Failures.
{
"idPagamento": "304578214",
"valorPago": 1000,
"status": "LIQUIDADO",
"motivoRecusa": null,
"data": {
"solicitacao": "2021-09-22 14:23:42",
"pagamento": "2021-09-22 10:23:42"
}
}

Get list of payment requests

GET/pagamento/resumo

Requires the scope: gn.barcode.pay.read

This endpoint should be used to request a summary of payment requests made within an informed period.

Request
This endpoint uses query params, so they should be sent by the URL, as exemplified in the code snippet below.
AttributeDescriptionRequiredType
dataInicioInicial date to show the list.yesstring Ex: XXXX-XX-XX
dataFimFinal date to show on the list.yesstring Ex: XXXX-XX-XX
Responses
The answers below represent Success and Failures.
{
"idPagamento": "304578214",
"valorPago": 1000,
"status": "LIQUIDADO",
"motivoRecusa": null,
"data": {
"solicitacao": "2021-09-22 14:23:42",
"pagamento": "2021-09-22 10:23:42"
}
}