Webhooks
Criar webhook
Configura um novo webhook para receber notificações de eventos
POST
/
api
/
v1
/
webhook
Criar webhook
curl --request POST \
--url https://api.quantumpay.com.br/api/v1/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://exemplo.com.br/webhook",
"events": [
"transaction_paid",
"transfer_completed"
]
}
'import requests
url = "https://api.quantumpay.com.br/api/v1/webhook"
payload = {
"url": "https://exemplo.com.br/webhook",
"events": ["transaction_paid", "transfer_completed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://exemplo.com.br/webhook',
events: ['transaction_paid', 'transfer_completed']
})
};
fetch('https://api.quantumpay.com.br/api/v1/webhook', 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.quantumpay.com.br/api/v1/webhook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://exemplo.com.br/webhook',
'events' => [
'transaction_paid',
'transfer_completed'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.quantumpay.com.br/api/v1/webhook"
payload := strings.NewReader("{\n \"url\": \"https://exemplo.com.br/webhook\",\n \"events\": [\n \"transaction_paid\",\n \"transfer_completed\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.quantumpay.com.br/api/v1/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://exemplo.com.br/webhook\",\n \"events\": [\n \"transaction_paid\",\n \"transfer_completed\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quantumpay.com.br/api/v1/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://exemplo.com.br/webhook\",\n \"events\": [\n \"transaction_paid\",\n \"transfer_completed\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "webhook_abc123xyz",
"url": "https://exemplo.com.br/webhook",
"events": [
"transaction_paid",
"transfer_completed"
],
"active": true,
"createdAt": "2024-12-31T12:00:00Z"
}{
"error": "INVALID_REQUEST",
"message": "O campo 'amount' é obrigatório",
"details": {}
}{
"error": "UNAUTHORIZED",
"message": "Token de autenticação inválido ou expirado"
}{
"error": "RATE_LIMITED",
"message": "Muitas requisições. Tente novamente em alguns minutos."
}Authorizations
Token JWT no cabeçalho Authorization
Body
application/json
URL que receberá as notificações
Example:
"https://exemplo.com.br/webhook"
Lista de eventos para notificar
Available options:
transaction_created, transaction_paid, transaction_refunded, infraction, transfer_created, transfer_updated, transfer_completed, transfer_canceled Example:
["transaction_paid", "transfer_completed"]
Response
Webhook criado com sucesso
ID único do webhook
Example:
"webhook_abc123xyz"
URL do webhook
Example:
"https://exemplo.com.br/webhook"
Eventos configurados
Example:
["transaction_paid", "transfer_completed"]
Se o webhook está ativo
Example:
true
Data de criação
Example:
"2024-12-31T12:00:00Z"
⌘I
Criar webhook
curl --request POST \
--url https://api.quantumpay.com.br/api/v1/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://exemplo.com.br/webhook",
"events": [
"transaction_paid",
"transfer_completed"
]
}
'import requests
url = "https://api.quantumpay.com.br/api/v1/webhook"
payload = {
"url": "https://exemplo.com.br/webhook",
"events": ["transaction_paid", "transfer_completed"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://exemplo.com.br/webhook',
events: ['transaction_paid', 'transfer_completed']
})
};
fetch('https://api.quantumpay.com.br/api/v1/webhook', 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.quantumpay.com.br/api/v1/webhook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://exemplo.com.br/webhook',
'events' => [
'transaction_paid',
'transfer_completed'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.quantumpay.com.br/api/v1/webhook"
payload := strings.NewReader("{\n \"url\": \"https://exemplo.com.br/webhook\",\n \"events\": [\n \"transaction_paid\",\n \"transfer_completed\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.quantumpay.com.br/api/v1/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://exemplo.com.br/webhook\",\n \"events\": [\n \"transaction_paid\",\n \"transfer_completed\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quantumpay.com.br/api/v1/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://exemplo.com.br/webhook\",\n \"events\": [\n \"transaction_paid\",\n \"transfer_completed\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "webhook_abc123xyz",
"url": "https://exemplo.com.br/webhook",
"events": [
"transaction_paid",
"transfer_completed"
],
"active": true,
"createdAt": "2024-12-31T12:00:00Z"
}{
"error": "INVALID_REQUEST",
"message": "O campo 'amount' é obrigatório",
"details": {}
}{
"error": "UNAUTHORIZED",
"message": "Token de autenticação inválido ou expirado"
}{
"error": "RATE_LIMITED",
"message": "Muitas requisições. Tente novamente em alguns minutos."
}