-
Notifications
You must be signed in to change notification settings - Fork 47
/
pixSend.php
36 lines (29 loc) · 936 Bytes
/
pixSend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require __DIR__ . '/../../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__ . '/../../config.json');
$options = json_decode($file, true);
//Para habilitar o end-point pix/enviar é necessário entrar em contato
//com a equipe Comercial da Gerencianet para novo anexo contratual.
$body = [
'valor' => '0.01',
'pagador' => [
'chave' => ''
],
'favorecido' => [
'chave' => ''
]
];
try {
$api = Gerencianet::getInstance($options);
$pix = $api->pixSend([], $body);
echo '<pre>' . json_encode($pix, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . '</pre>';
} catch (GerencianetException $e) {
print_r($e->code);
print_r($e->error);
print_r($e->errorDescription);
throw new Error($e->error);
} catch (Exception $e) {
throw new Error($e->getMessage());
}