curl --request POST \
--url https://sandbox.4seletpay.com.br/api/v1/webhook-endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'account: <account>' \
--data '
{
"url": "https://meusite.com.br/webhook",
"events": [
"order.paid",
"charge.failed",
"subscription.canceled"
]
}
'import requests
url = "https://sandbox.4seletpay.com.br/api/v1/webhook-endpoints"
payload = {
"url": "https://meusite.com.br/webhook",
"events": ["order.paid", "charge.failed", "subscription.canceled"]
}
headers = {
"account": "<account>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
account: '<account>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://meusite.com.br/webhook',
events: ['order.paid', 'charge.failed', 'subscription.canceled']
})
};
fetch('https://sandbox.4seletpay.com.br/api/v1/webhook-endpoints', 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://sandbox.4seletpay.com.br/api/v1/webhook-endpoints",
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://meusite.com.br/webhook',
'events' => [
'order.paid',
'charge.failed',
'subscription.canceled'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"account: <account>"
],
]);
$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://sandbox.4seletpay.com.br/api/v1/webhook-endpoints"
payload := strings.NewReader("{\n \"url\": \"https://meusite.com.br/webhook\",\n \"events\": [\n \"order.paid\",\n \"charge.failed\",\n \"subscription.canceled\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("account", "<account>")
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://sandbox.4seletpay.com.br/api/v1/webhook-endpoints")
.header("account", "<account>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://meusite.com.br/webhook\",\n \"events\": [\n \"order.paid\",\n \"charge.failed\",\n \"subscription.canceled\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.4seletpay.com.br/api/v1/webhook-endpoints")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["account"] = '<account>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://meusite.com.br/webhook\",\n \"events\": [\n \"order.paid\",\n \"charge.failed\",\n \"subscription.canceled\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"mensagem": "Webhook criado com sucesso",
"erro": false,
"mensagenserro": [],
"codigoretorno": 201,
"id": "42",
"data": []
}{
"mensagem": "Unauthenticated.",
"erro": true,
"mensagenserro": [],
"codigoretorno": 401,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}{
"mensagem": "The charge code does not match any charge",
"erro": true,
"mensagenserro": [],
"codigoretorno": 404,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}{
"mensagem": "Um erro aconteceu.",
"erro": true,
"mensagenserro": [
"Erro interno. Tente novamente mais tarde."
],
"codigoretorno": 500,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}Criar Endpoint
Cria um novo endpoint de webhook para a conta informada no header account. O endpoint receberá notificações POST para os eventos selecionados. Requer autenticação Bearer.
curl --request POST \
--url https://sandbox.4seletpay.com.br/api/v1/webhook-endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'account: <account>' \
--data '
{
"url": "https://meusite.com.br/webhook",
"events": [
"order.paid",
"charge.failed",
"subscription.canceled"
]
}
'import requests
url = "https://sandbox.4seletpay.com.br/api/v1/webhook-endpoints"
payload = {
"url": "https://meusite.com.br/webhook",
"events": ["order.paid", "charge.failed", "subscription.canceled"]
}
headers = {
"account": "<account>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
account: '<account>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://meusite.com.br/webhook',
events: ['order.paid', 'charge.failed', 'subscription.canceled']
})
};
fetch('https://sandbox.4seletpay.com.br/api/v1/webhook-endpoints', 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://sandbox.4seletpay.com.br/api/v1/webhook-endpoints",
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://meusite.com.br/webhook',
'events' => [
'order.paid',
'charge.failed',
'subscription.canceled'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"account: <account>"
],
]);
$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://sandbox.4seletpay.com.br/api/v1/webhook-endpoints"
payload := strings.NewReader("{\n \"url\": \"https://meusite.com.br/webhook\",\n \"events\": [\n \"order.paid\",\n \"charge.failed\",\n \"subscription.canceled\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("account", "<account>")
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://sandbox.4seletpay.com.br/api/v1/webhook-endpoints")
.header("account", "<account>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://meusite.com.br/webhook\",\n \"events\": [\n \"order.paid\",\n \"charge.failed\",\n \"subscription.canceled\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.4seletpay.com.br/api/v1/webhook-endpoints")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["account"] = '<account>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://meusite.com.br/webhook\",\n \"events\": [\n \"order.paid\",\n \"charge.failed\",\n \"subscription.canceled\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"mensagem": "Webhook criado com sucesso",
"erro": false,
"mensagenserro": [],
"codigoretorno": 201,
"id": "42",
"data": []
}{
"mensagem": "Unauthenticated.",
"erro": true,
"mensagenserro": [],
"codigoretorno": 401,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}{
"mensagem": "The charge code does not match any charge",
"erro": true,
"mensagenserro": [],
"codigoretorno": 404,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}{
"mensagem": "Um erro aconteceu.",
"erro": true,
"mensagenserro": [
"Erro interno. Tente novamente mais tarde."
],
"codigoretorno": 500,
"id": "00000000-0000-0000-0000-000000000000",
"data": []
}account com o código da conta. O endpoint criado começa com status Ativo e receberá notificações POST para cada evento listado em events.events deve conter ao menos um evento válido. Consulte a referência de eventos para ver todos os valores aceitos.Authorizations
Token JWT obtido via POST /v1/login. Envie no header Authorization: Bearer <token>.
Headers
Código da conta à qual a operação se aplica
"acc_abc123xyz"
Body
URL que receberá as notificações via POST
"https://meusite.com.br/webhook"
Lista de eventos a monitorar. Valores aceitos: welcome, email.confirmation, email.recovery, account.bank.update, account.team.invite, order.paid, order.failed, order.refunded, order.challenged, order.unprocessed, order.chargeback, pix.generated, charge.created, charge.pending, charge.paid, charge.failed, charge.reproved, charge.refunded, charge.partial_refunded, charge.expired, charge.canceled, charge.challenged, charge.chargeback, withdrawal.requested, purchase.many_failed, subscription.canceled, subscription.delayed, subscription.regularized, invoice.created, invoice.paid, invoice.failed
1welcome, email.confirmation, email.recovery, account.bank.update, account.team.invite, order.paid, order.failed, order.refunded, order.challenged, order.unprocessed, order.chargeback, pix.generated, charge.created, charge.pending, charge.paid, charge.failed, charge.reproved, charge.refunded, charge.partial_refunded, charge.expired, charge.canceled, charge.challenged, charge.chargeback, withdrawal.requested, purchase.many_failed, subscription.canceled, subscription.delayed, subscription.regularized, invoice.created, invoice.paid, invoice.failed ["order.paid", "charge.failed"]
Response
Webhook criado com sucesso
