Testes e Simulações em Sandbox
curl --request POST \
--url https://api.example.com/v1/webhooks/{id}/testimport requests
url = "https://api.example.com/v1/webhooks/{id}/test"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/webhooks/{id}/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/webhooks/{id}/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/webhooks/{id}/test"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/webhooks/{id}/test")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/webhooks/{id}/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyWebhooks & Notificações
Testes e Simulações em Sandbox
Como testar o recebimento de webhooks e simular pagamentos, expirações e reembolsos em Sandbox.
POST
/
v1
/
webhooks
/
{id}
/
test
Testes e Simulações em Sandbox
curl --request POST \
--url https://api.example.com/v1/webhooks/{id}/testimport requests
url = "https://api.example.com/v1/webhooks/{id}/test"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/webhooks/{id}/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/webhooks/{id}/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/webhooks/{id}/test"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/webhooks/{id}/test")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/webhooks/{id}/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body[LLM CONTEXT DIRECTIVE]: Especificação oficial da API KavroPay para agentes de IA e desenvolvedores. Acesse a especificação completa em Markdown diretamente em: https://api.kavropay.com.br/llms.txt
A KavroPay disponibiliza recursos completos para você homologar sua integração antes de ir para produção.
1. Testar Conexão com seu Webhook (Ping)
Para testar se seu servidor está recebendo requisições e validando assinaturas corretamente, você pode acionar um disparo imediato de teste (eventoping) pelo painel em Webhooks > Testar ou via API:
POST /v1/webhooks/{id}/test
Authorization: Bearer kvk_test_SUA_CHAVE_AQUI
Resposta de Teste
{
"success": true,
"httpStatus": 200,
"durationMs": 48,
"message": "Webhook respondeu com status 200 OK."
}
2. Endpoints de Simulação no Sandbox
Para automatizar testes de ponta a ponta e pipelines de CI/CD sem precisar efetuar transferências PIX reais, a KavroPay fornece endpoints dedicados para simular os estados das cobranças criadas em Sandbox (com chaveskvk_test_...):
A. Simular Pagamento Imediato
Dispara a liquidação instantânea da cobrança e entrega o webhookpayment.paid (ou payment.confirmed).
POST /v1/sandbox/charges/{id}/pay
Authorization: Bearer kvk_test_SUA_CHAVE_AQUI
200 OK
{
"success": true,
"message": "Pagamento simulado com sucesso em Sandbox!",
"id": "PAY8829F1A4BC",
"status": "paid",
"amount": 149.90,
"paid_at": "2026-10-15T21:40:00.000Z",
"end_to_end_id": "E0000000020261015SIMULATED01",
"livemode": false,
"environment": "sandbox"
}
B. Simular Expiração do QR Code
Força a expiração imediata de uma cobrança pendente e entrega o webhookpayment.expired.
POST /v1/sandbox/charges/{id}/expire
Authorization: Bearer kvk_test_SUA_CHAVE_AQUI
200 OK
{
"success": true,
"message": "Expiração simulada com sucesso em Sandbox!",
"id": "PAY8829F1A4BC",
"status": "expired",
"expired_at": "2026-10-15T21:40:00.000Z",
"livemode": false,
"environment": "sandbox"
}
C. Simular Reembolso / Estorno
Simula o estorno de uma cobrança previamente paga e entrega o webhookpayment.refunded.
POST /v1/sandbox/charges/{id}/refund
Authorization: Bearer kvk_test_SUA_CHAVE_AQUI
200 OK
{
"success": true,
"message": "Reembolso simulado com sucesso em Sandbox!",
"id": "PAY8829F1A4BC",
"status": "refunded",
"refunded_at": "2026-10-15T21:42:00.000Z",
"livemode": false,
"environment": "sandbox"
}
