Skip to content

Commit 3b47373

Browse files
✨feat: New examples of Pix automatic locRec and rec endpoints
1 parent 063b283 commit 3b47373

12 files changed

+469
-2
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/pix-automatico#criar-recorrência-de-pix-automático
6+
*/
7+
8+
$autoload = realpath(__DIR__ . "/../../../../vendor/autoload.php");
9+
if (!file_exists($autoload)) {
10+
die("Autoload file not found or on path <code>$autoload</code>.");
11+
}
12+
require_once $autoload;
13+
14+
use Efi\Exception\EfiException;
15+
use Efi\EfiPay;
16+
17+
$optionsFile = __DIR__ . "/../../../credentials/options.php";
18+
if (!file_exists($optionsFile)) {
19+
die("Options file not found or on path <code>$options</code>.");
20+
}
21+
$options = include $optionsFile;
22+
23+
$body = [
24+
"vinculo" => [
25+
"contrato" => "63100862",
26+
"devedor" => [
27+
"cpf" => "11122233344",
28+
// "cnpj" => "11122233344444",
29+
"nome" => "Gorbadoc Oldbuck"
30+
],
31+
"objeto" => "Streamming"
32+
],
33+
"calendario" => [
34+
"dataInicial" => "2026-01-01",
35+
"dataFinal" => "2027-12-31",
36+
"periodicidade" => "MENSAL" // SEMANAL/MENSAL/TRIMESTRAL/SEMESTRAL/ANUAL
37+
],
38+
"valor" => [
39+
"valorRec" => "35.00",
40+
// "valorMinimoRecebedor" => "30.00"
41+
],
42+
"politicaRetentativa" => "NAO_PERMITE", // PERMITE_3R_7D
43+
"loc" => 0,
44+
"ativacao" => [
45+
"dadosJornada" => [
46+
"txid" => "33beb661beda44a8928fef47dbeb2dc5"
47+
]
48+
]
49+
];
50+
51+
try {
52+
$api = new EfiPay($options);
53+
$response = $api->pixCreateRecurrenceAutomatic($params = [], $body);
54+
55+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
56+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
57+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
58+
} else {
59+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
60+
}
61+
} catch (EfiException $e) {
62+
print_r($e->code . "<br>");
63+
print_r($e->error . "<br>");
64+
print_r($e->errorDescription) . "<br>";
65+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
66+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
67+
}
68+
} catch (Exception $e) {
69+
print_r($e->getMessage());
70+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/pix-automatico#consultar-recorrência-de-pix-automático
6+
*/
7+
8+
$autoload = realpath(__DIR__ . "/../../../../vendor/autoload.php");
9+
if (!file_exists($autoload)) {
10+
die("Autoload file not found or on path <code>$autoload</code>.");
11+
}
12+
require_once $autoload;
13+
14+
use Efi\Exception\EfiException;
15+
use Efi\EfiPay;
16+
17+
$optionsFile = __DIR__ . "/../../../credentials/options.php";
18+
if (!file_exists($optionsFile)) {
19+
die("Options file not found or on path <code>$options</code>.");
20+
}
21+
$options = include $optionsFile;
22+
23+
$params = [
24+
"idRec" => "R000000000000000000000000001"
25+
// "txid" => "0000000000000000000000000001"
26+
];
27+
28+
try {
29+
$api = new EfiPay($options);
30+
$response = $api->pixDetailRecurrenceAutomatic($params);
31+
32+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
33+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
34+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
35+
} else {
36+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
37+
}
38+
} catch (EfiException $e) {
39+
print_r($e->code . "<br>");
40+
print_r($e->error . "<br>");
41+
print_r($e->errorDescription) . "<br>";
42+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
43+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
44+
}
45+
} catch (Exception $e) {
46+
print_r($e->getMessage());
47+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/pix-automatico#consultar-lista-de-recorrências-de-pix-automático
6+
*/
7+
8+
$autoload = realpath(__DIR__ . "/../../../../vendor/autoload.php");
9+
if (!file_exists($autoload)) {
10+
die("Autoload file not found or on path <code>$autoload</code>.");
11+
}
12+
require_once $autoload;
13+
14+
use Efi\Exception\EfiException;
15+
use Efi\EfiPay;
16+
17+
$optionsFile = __DIR__ . "/../../../credentials/options.php";
18+
if (!file_exists($optionsFile)) {
19+
die("Options file not found or on path <code>$options</code>.");
20+
}
21+
$options = include $optionsFile;
22+
23+
$params = [
24+
"inicio" => "2025-01-01T00:00:00Z",
25+
"fim" => "2025-12-31T23:59:59Z",
26+
// "cpf" => '11122233344',
27+
// "cnpj" => '11122233344444',
28+
// "locationPresente" => true,
29+
// "status" => 'CRIADA', // CRIADA/ATIVA/CONCLUIDA/EXPIRADA/REJEITADA/CANCELADA
30+
// "convenio" => '0000000000000001',
31+
// "paginacao.paginaAtual" => 1,
32+
// "paginacao.itensPorPagina" => 10
33+
];
34+
35+
try {
36+
$api = new EfiPay($options);
37+
$response = $api->pixListRecurrenceAutomatic($params);
38+
39+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
40+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
41+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
42+
} else {
43+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
44+
}
45+
} catch (EfiException $e) {
46+
print_r($e->code . "<br>");
47+
print_r($e->error . "<br>");
48+
print_r($e->errorDescription) . "<br>";
49+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
50+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
51+
}
52+
} catch (Exception $e) {
53+
print_r($e->getMessage());
54+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/pix-automatico#revisar-recorrência-de-pix-automático
6+
*/
7+
8+
$autoload = realpath(__DIR__ . "/../../../../vendor/autoload.php");
9+
if (!file_exists($autoload)) {
10+
die("Autoload file not found or on path <code>$autoload</code>.");
11+
}
12+
require_once $autoload;
13+
14+
use Efi\Exception\EfiException;
15+
use Efi\EfiPay;
16+
17+
$optionsFile = __DIR__ . "/../../../credentials/options.php";
18+
if (!file_exists($optionsFile)) {
19+
die("Options file not found or on path <code>$options</code>.");
20+
}
21+
$options = include $optionsFile;
22+
23+
$params = [
24+
"idRec" => "R000000000000000000000000001"
25+
];
26+
27+
$body = [
28+
"loc" => 1,
29+
"vinculo" => [
30+
"devedor" => [
31+
"nome" => "Gorbadoc Oldbuck"
32+
]
33+
],
34+
"calendario" => [
35+
"dataInicial" => "2026-04-01"
36+
],
37+
"ativacao" => [
38+
"dadosJornada" => [
39+
"txid" => "0000000000000000000000000001"
40+
]
41+
]
42+
];
43+
44+
try {
45+
$api = new EfiPay($options);
46+
$response = $api->pixUpdateRecurrenceAutomatic($params, $body);
47+
48+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
49+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
50+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
51+
} else {
52+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
53+
}
54+
} catch (EfiException $e) {
55+
print_r($e->code . "<br>");
56+
print_r($e->error . "<br>");
57+
print_r($e->errorDescription) . "<br>";
58+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
59+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
60+
}
61+
} catch (Exception $e) {
62+
print_r($e->getMessage());
63+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/payload-locations#criar-location-do-payload-de-recorrência-de-pix-automático
6+
*/
7+
8+
$autoload = realpath(__DIR__ . "/../../../../vendor/autoload.php");
9+
if (!file_exists($autoload)) {
10+
die("Autoload file not found or on path <code>$autoload</code>.");
11+
}
12+
require_once $autoload;
13+
14+
use Efi\Exception\EfiException;
15+
use Efi\EfiPay;
16+
17+
$optionsFile = __DIR__ . "/../../../credentials/options.php";
18+
if (!file_exists($optionsFile)) {
19+
die("Options file not found or on path <code>$options</code>.");
20+
}
21+
$options = include $optionsFile;
22+
23+
try {
24+
$api = new EfiPay($options);
25+
$response = $api->pixCreateLocationRecurrenceAutomatic();
26+
27+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
28+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
29+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
30+
} else {
31+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
32+
}
33+
} catch (EfiException $e) {
34+
print_r($e->code . "<br>");
35+
print_r($e->error . "<br>");
36+
print_r($e->errorDescription) . "<br>";
37+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
38+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
39+
}
40+
} catch (Exception $e) {
41+
print_r($e->getMessage());
42+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/payload-locations#recuperar-location-do-payload-de-recorrêancia-de-pix-automático
6+
*/
7+
8+
$autoload = realpath(__DIR__ . "/../../../../vendor/autoload.php");
9+
if (!file_exists($autoload)) {
10+
die("Autoload file not found or on path <code>$autoload</code>.");
11+
}
12+
require_once $autoload;
13+
14+
use Efi\Exception\EfiException;
15+
use Efi\EfiPay;
16+
17+
$optionsFile = __DIR__ . "/../../../credentials/options.php";
18+
if (!file_exists($optionsFile)) {
19+
die("Options file not found or on path <code>$options</code>.");
20+
}
21+
$options = include $optionsFile;
22+
23+
$params = [
24+
"id" => 0
25+
];
26+
27+
try {
28+
$api = new EfiPay($options);
29+
$response = $api->pixDetailLocationRecurrenceAutomatic($params);
30+
31+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
32+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
33+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
34+
} else {
35+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
36+
}
37+
} catch (EfiException $e) {
38+
print_r($e->code . "<br>");
39+
print_r($e->error . "<br>");
40+
print_r($e->errorDescription) . "<br>";
41+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
42+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
43+
}
44+
} catch (Exception $e) {
45+
print_r($e->getMessage());
46+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
*https://dev.efipay.com.br/docs/api-pix/payload-locations#consultar-locations-de-recorrência-de-pix-automático-cadastradas
6+
*/
7+
8+
$autoload = realpath(__DIR__ . "/../../../../vendor/autoload.php");
9+
if (!file_exists($autoload)) {
10+
die("Autoload file not found or on path <code>$autoload</code>.");
11+
}
12+
require_once $autoload;
13+
14+
use Efi\Exception\EfiException;
15+
use Efi\EfiPay;
16+
17+
$optionsFile = __DIR__ . "/../../../credentials/options.php";
18+
if (!file_exists($optionsFile)) {
19+
die("Options file not found or on path <code>$options</code>.");
20+
}
21+
$options = include $optionsFile;
22+
23+
$params = [
24+
"inicio" => "2025-01-22T00:00:00Z",
25+
"fim" => "2025-12-31T23:59:59Z",
26+
// "idRecPresente" => "000000000000001",
27+
// "convenio" => "000000000000001",
28+
// "paginacao.paginaAtual" => 1,
29+
// "paginacao.itensPorPagina" => 50
30+
];
31+
32+
try {
33+
$api = new EfiPay($options);
34+
$response = $api->pixListLocationRecurrenceAutomatic($params);
35+
36+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
37+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
38+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
39+
} else {
40+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
41+
}
42+
} catch (EfiException $e) {
43+
print_r($e->code . "<br>");
44+
print_r($e->error . "<br>");
45+
print_r($e->errorDescription) . "<br>";
46+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
47+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
48+
}
49+
} catch (Exception $e) {
50+
print_r($e->getMessage());
51+
}

0 commit comments

Comments
 (0)