Histórico de mensagens sobre pixConfigWebhook

EXIBINDO CONVERSAS RECENTES:

Texto: pixConfigWebhook
# pix
Avatar discord do usuario felipenunes0714

felipenunes0714


/
Detailed endpoint documentation
https://dev.efipay.com.br/docs/api-pix/webhooks#configurar-o-webhook-pix
/

$autoload = realpath(__DIR__ . "../../../../../../../vendor/autoload.php");
if (!file_exists($autoload)) {
die("Autoload file not found or on path $autoload.");
}
require_once $autoload;

use Efi\Exception\EfiException;
use Efi\EfiPay;

$optionsFile = __DIR__ . "/../../credentials/options.php";
if (!file_exists($optionsFile)) {
die("Options file not found or on path $options.");
}
$options = include $optionsFile;

$options["headers"] = [
"x-skip-mtls-checking" => false
];

$params = [
"chave" => ""
];

$body = [
"webhookUrl" => ""
];


try {
$api = new EfiPay($options);
$response = $api->pixConfigWebhook($params, $body);

if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
print_r("

" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
");
print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
");
} else {
print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
");
}
} catch (EfiException $e) {
print_r($e->code . "
");
print_r($e->error . "
");
print_r($e->errorDescription) . "
";
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
");
}
} catch (Exception $e) {
print_r($e->getMessage());
}

# pix
Avatar discord do usuario felipenunes0714

felipenunes0714

Ver Respostas


/
Detailed endpoint documentation
https://dev.efipay.com.br/docs/api-pix/webhooks#configurar-o-webhook-pix
/

$autoload = realpath(__DIR__ . "/../../../vendor/autoload.php");
if (!file_exists($autoload)) {
die("Autoload file not found or on path $autoload.");
}
require_once $autoload;

use Efi\Exception\EfiException;
use Efi\EfiPay;

$optionsFile = __DIR__ . "/../../credentials/options.php";
if (!file_exists($optionsFile)) {
die("Options file not found or on path $options.");
}
$options = include $optionsFile;

$options["headers"] = [
"x-skip-mtls-checking" => false
];

$params = [
"chave" => "12345"
];

$body = [
"webhookUrl" => "www.meulink.com"
];

try {
$api = new EfiPay($options);
$response = $api->pixConfigWebhook($params, $body);

if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
print_r("

" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
");
print_r("
" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
");
} else {
print_r("
" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
");
}
} catch (EfiException $e) {
print_r($e->code . "
");
print_r($e->error . "
");
print_r($e->errorDescription) . "
";
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
print_r("
" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "
");
}
} catch (Exception $e) {
print_r($e->getMessage());
}

# pix
Avatar discord do usuario palloma_efi

palloma_efi

Ver Respostas

Bom dia @felipenunes0714 ! Para cadastrar o webhook, você deve utilizar este método: https://github.com/efipay/sdk-php-apis-efi/blob/main/examples/pix/webhooks/pixConfigWebhook.php

# pix
Avatar discord do usuario gabreudev

gabreudev

public JSONObject configHook(){

JSONObject options = configuringJsonObject();

options.put("x-skip-mtls-checking", "true");

HashMap params = new HashMap<>();
params.put("chave", "2d9c6bfd-d19e-4123-8a35-c2f0caac55db");

JSONObject body = new JSONObject();
body.put("webhookUrl", "https://bde1-45-170-222-201.ngrok-free.app/webhook/");

try {
EfiPay efi = new EfiPay(options);
JSONObject response = efi.call("pixConfigWebhook", params, body);
System.out.println(response);
return response;

# pix
Avatar discord do usuario gabreudev

gabreudev

Ver Respostas

JSONObject options = configuringJsonObject();

options.put("x-skip-mtls-checking", "true");

HashMap params = new HashMap<>();
params.put("chave", "minhachave");

JSONObject body = new JSONObject();
body.put("webhookUrl", "https://37c3-45-170-222-201.ngrok-free.app/webhook/");

try {
EfiPay efi = new EfiPay(options);
JSONObject response = efi.call("pixConfigWebhook", params, body);
System.out.println(response);
return response;

}catch (EfiPayException e){
System.out.println(e.getError());
System.out.println(e.getErrorDescription());
return null;
}

# pix
Avatar discord do usuario mesenga.

mesenga.

Ver Respostas

cara, estou nesse mesmo ponto ai... consegui configurar a url usando pixConfigWebhook e skip mtls , preciso confirmar agora se ainda há necessidade da comparação locamente

# pix
Avatar discord do usuario mesenga.

mesenga.

Ver Respostas

olá, consegui cadastrar a url usando pixConfigWebhook (sdk typescript), agora depois de gerar a cobrança e cadastrar o webhook recebo uma requisição na url cadastrada com o seguinte payload

DEFAULT 2024-05-30T16:03:39.462573Z /webhook payload: {
DEFAULT 2024-05-30T16:03:39.462585Z pix: [
DEFAULT 2024-05-30T16:03:39.462589Z {
DEFAULT 2024-05-30T16:03:39.462593Z endToEndId: 'E09089356202405301603API5d83da44',
DEFAULT 2024-05-30T16:03:39.462595Z txid: '89ddfba0723a4ef2b9ef5597381368aa',
DEFAULT 2024-05-30T16:03:39.462598Z chave: ,
DEFAULT 2024-05-30T16:03:39.462600Z valor: '4.00',
DEFAULT 2024-05-30T16:03:39.462602Z horario: '2024-05-30T16:03:09.000Z',
DEFAULT 2024-05-30T16:03:39.462605Z infoPagador: 'Teste de pagamento em ambiente sandbox'
DEFAULT 2024-05-30T16:03:39.462610Z }
DEFAULT 2024-05-30T16:03:39.462612Z ]
DEFAULT 2024-05-30T16:03:39.462615Z }

eu pensei que receberia o objeto com a propriedade status

alguém pode me ajudar a entender? grato

# pix
Avatar discord do usuario joao.dbm

joao.dbm

O 401 mostra quando tento adicionar o webhook pela função gerencianet.pixConfigWebhook()

# pix
Avatar discord do usuario .thomasjackson

.thomasjackson

public async Task SaveWebhookUrl(Guid chavePix, string webhoookUrl)
{
dynamic efi = new EfiPay(
appSettings.Payment.ClientId,
appSettings.Payment.ClientSecret,
appSettings.Payment.Sandbox,
appSettings.Payment.Certificate
);

var headers = "{\"x-skip-mtls-checking\": \"true\"}";

var param = new
{
chave = chavePix.ToString()
};

var body = new
{
webhookUrl = webhoookUrl
};
var result = Task.FromResult(efi.PixConfigWebhook(param, body, headers));
await Task.FromResult(efi.PixConfigWebhook(param, body, headers));
}

# pix
Avatar discord do usuario .thomasjackson

.thomasjackson

Ver Respostas

ok, eu fiz essa implementacao
public async Task SaveWebhookUrl(Guid chavePix, string webhoookUrl)
{
dynamic efi = new EfiPay(
appSettings.Payment.ClientId,
appSettings.Payment.ClientSecret,
appSettings.Payment.Sandbox,
appSettings.Payment.Certificate
);

var headers = "{\"x-skip-mtls-checking\": \"true\"}";

var param = new
{
chave = chavePix.ToString()
};

var body = new
{
webhookUrl = webhoookUrl
};

await Task.FromResult(efi.PixConfigWebhook(param, body, headers));
}