Histórico de mensagens sobre pixConfigWebhook em pix

EXIBINDO CONVERSAS RECENTES:

Texto: pixConfigWebhook
Canal: 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());
}

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

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;

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;
}

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

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

Avatar discord do usuario joao.dbm

joao.dbm

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

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));
}

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));
}

Avatar discord do usuario rubenskuhl

rubenskuhl

Ver Respostas

Talvez o pessoal da Efí possa comentar desse exemplo... do SDK de PHP, é o pixConfigWebhook.php

Avatar discord do usuario .thallestks

.thallestks

Por exemplo, gerencianet.pixConfigWebhook

Avatar discord do usuario .ilselangnar

.ilselangnar

Ver Respostas

Oi Guilherme:

Estou com um problema com o webhook

Consigo listar os webhooks configurados sem problema.

O problema vem quando quero configurar um novo webhook para receber notificações de pagamento

Aqui esta meu codigo:


const efipay = new EfiPay(options)

async function api_configure_webhook_efipay( req, res, next ) {

let body = {
webhookUrl: 'https://origami.ink/webhook_paymentefipay',
}

let params = {
chave: '8712f01e-e8e6-4eab-a636-ddc8e13fe8b7',
}

try {
let object_result = await efipay.pixConfigWebhook(params, body)
printf( "[configure_webhook] -> object_result -> ", object_result )
res.json( object_result )
} catch( e ) {
// throw e
res.json( e )
}

}

module.exports = api_configure_webhook_efipay


Aqui esta o erro:

{
"nome": "webhook_invalido",
"mensagem": "A requisição na URL informada falhou com o erro: ECONNRESET"
}

Avatar discord do usuario .ilselangnar

.ilselangnar

Estou com um problema com o webhook

Consigo listar os webhooks configurados sem problema.

O problema vem quando quero configurar um novo webhook para receber notificações de pagamento

Aqui esta meu codigo:


const efipay = new EfiPay(options)

async function api_configure_webhook_efipay( req, res, next ) {

let body = {
webhookUrl: 'https://origami.ink/webhook_paymentefipay',
}

let params = {
chave: '8712f01e-e8e6-4eab-a636-ddc8e13fe8b7',
}

try {
let object_result = await efipay.pixConfigWebhook(params, body)
printf( "[configure_webhook] -> object_result -> ", object_result )
res.json( object_result )
} catch( e ) {
// throw e
res.json( e )
}

}

module.exports = api_configure_webhook_efipay


Aqui esta o erro:

{
"nome": "webhook_invalido",
"mensagem": "A requisição na URL informada falhou com o erro: ECONNRESET"
}

Avatar discord do usuario kauan_bs

kauan_bs

Boa tarde. Estou tentando configurar o webhook no meu servidor porém estou recebendo 401. Estes são meus códigos :

js

const httpOptions = {
cert: fs.readFileSync("gd_bundle-g2-g1.crt"), // Certificado fullchain do dominio
key: fs.readFileSync("56092e4c5a31e0c5.crt"), // Chave privada do domínio
ca: fs.readFileSync("chain-pix-prod.crt"), // Certificado público da Efí
minVersion: "TLSv1.2",
requestCert: true,
rejectUnauthorized: false, //Caso precise que os demais endpoints não rejeitem requisições sem mTLS, você pode alterar para false
};

app.post("/webhookEfi", (request, response) => {
if (request.socket.authorized) {
console.log("autorizado")
response.status(200).end();
} else {
console.log("não autorizado")
response.status(401).end();
}
});

app.post("/webhookEfiConfig", async (req, res) => {
try {
let body = {
webhookUrl: "{minhaurl}/webhookEfi",
};

let params = {
chave: "6e364195-3e3d-4ee5-8ca0-14db77d30593",
};

const efipay = new EfiPay(options);

await efipay.pixConfigWebhook(params, body);

// Se tudo correr bem, você pode enviar uma resposta de sucesso
res.status(200).send("Configuração do webhook concluída com sucesso!");
} catch (error) {
// Se ocorrer algum erro, você pode enviar uma resposta de erro e registrar o erro
console.error("Erro ao configurar o webhook:", error);
res.status(500).send("Ocorreu um erro ao configurar o webhook.");
}
});
Alguem sabe qual o motivo ?

Avatar discord do usuario kauan_bs

kauan_bs

Ver Respostas

Tentei configurar o webhook, porém não recebi a requisição na url designada. É preciso apenas configurar o webhook com o pixConfigWebhook?

Avatar discord do usuario alexporfirio_84692

alexporfirio_84692

Bom dia como faço para criar um webhook sem o TLS meu servidor é compartilhado: estou usando o exemplo: pixConfigWebhook.php ?

Avatar discord do usuario _josemax

_josemax

Ver Respostas

400
webhook_invalido
A URL informada respondeu com o código HTTP 400Efi\Exception\EfiException Object ( [message:protected] => A URL informada respondeu com o código HTTP 400 [string:Exception:private] => [code:protected] => 400 [file:protected] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/src/Efi/Request.php [line:protected] => 241 [trace:Exception:private] => Array ( [0] => Array ( [file] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/src/Efi/Request.php [line] => 166 [function] => handleClientException [class] => Efi\Request [type] => -> ) [1] => Array ( [file] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/src/Efi/ApiRequest.php [line] => 54 [function] => send [class] => Efi\Request [type] => -> ) [2] => Array ( [file] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/src/Efi/Endpoints.php [line] => 120 [function] => send [class] => Efi\ApiRequest [type] => -> ) [3] => Array ( [file] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/src/Efi/Endpoints.php [line] => 56 [function] => Efi\{closure} [class] => Efi\Endpoints [type] => -> ) [4] => Array ( [file] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/aplication/pix/webhooks/pixConfigWebhook.php [line] => 36 [function] => __call [class] => Efi\Endpoints [type] => -> ) ) [previous:Exception:private] => [error:Efi\Exception\EfiException:private] => webhook_invalido [errorDescription:Efi\Exception\EfiException:private] => A URL informada respondeu com o código HTTP 400 )

Avatar discord do usuario jlmendessilva

jlmendessilva

Estou tentando rodar examples do sdk para configurar o wehook esta dando fatal error:
Fatal error: Uncaught TypeError: Argument 2 passed to Efi\BaseModel::__set() must be an instance of Efi\mixed, array given in C:\xampp\htdocs\efi\sdk-php-apis-efi\src\Efi\BaseModel.php:34 Stack trace: #0 C:\xampp\htdocs\efi\sdk-php-apis-efi\src\Efi\Auth.php(61): Efi\BaseModel->__set('requestOptions', Array) #1 C:\xampp\htdocs\efi\sdk-php-apis-efi\src\Efi\Auth.php(48): Efi\Auth->initializeRequestOptions() #2 C:\xampp\htdocs\efi\sdk-php-apis-efi\src\Efi\ApiRequest.php(46): Efi\Auth->authorize() #3 C:\xampp\htdocs\efi\sdk-php-apis-efi\src\Efi\Endpoints.php(120): Efi\ApiRequest->send('put', '/v2/webhook/894...', 'webhook.write', Array) #4 C:\xampp\htdocs\efi\sdk-php-apis-efi\src\Efi\Endpoints.php(58): Efi\Endpoints->Efi\{closure}(Array, Array) #5 C:\xampp\htdocs\efi\sdk-php-apis-efi\examples\pix\webhooks\pixConfigWebhook.php(37): Efi\Endpoints->__call('pixConfigWebhoo...', Array) #6 {main} thrown in C:\xampp\htdocs\efi\sdk-php-apis-efi\src\Efi\BaseModel.php on line 34

Avatar discord do usuario _josemax

_josemax

400
webhook_invalido Uma URL informada respondeu com o código HTTP 400Efi\Exception\EfiException Object ( [message:protected] => Uma URL informada respondeu com o código HTTP 400 [string:Exception:private] => [code:protected] => 400 [arquivo: protegido] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/src/Efi/Request.php [linha: protegido] => 241 [trace:Exception:private] => Array ( [0] => Array ( [arquivo] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/src/Efi/Request.php [line] => 166 [função] => handleClientException [classe] => Efi\Request [tipo] => -> ) [1] => Array ( [arquivo] => /home/tract/htdocs/tract.digital/Controller/sdk-php -apis-efi/src/Efi/ApiRequest.php [linha] => 54 [função] => enviar [classe] => Efi\Request [tipo] => -> ) [2] => Array ( [arquivo] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/src/Efi/Endpoints.php [linha] => 120 [função] => enviar [classe] => Efi\ApiRequest [type] => -> ) [3] => Array ( [file] => /home/tract/htdocs/tract.digital/Controller/sdk-php-apis-efi/src/Efi/Endpoints.php [linha ] => 56 [função] => Efi\{closure} [classe] => Efi\Endpoints [tipo] => -> ) [4] => Array ( [arquivo] => /home/tract/htdocs/tract .digital/Controller/sdk-php-apis-efi/aplication/pix/webhooks/pixConfigWebhook.php [linha] => 36 [função] => __call [classe] => Efi\Endpoints [tipo] => -> ) ) [anterior:Exception:private] => [error:Efi\Exception\EfiException:private] => webhook_invalido [errorDescription:Efi\Exception\EfiException:private] => A URL informada respondeu com o código HTTP 400 )