Probar las subscripciones webhook
curl --request POST \
--url https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test \
--header 'Authorization: Bearer <token>'import requests
url = "https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/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://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": false,
"code": "PARTNER.TEST_PARTNER_SUBSCRIPTION_ERROR",
"message": "Error sending test webhook to some subscriptions"
}Webhooks
Probar webhooks
POST
/
partner
/
{partnerId}
/
subscriptions
/
test
Probar las subscripciones webhook
curl --request POST \
--url https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test \
--header 'Authorization: Bearer <token>'import requests
url = "https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/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://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://e3-kausanna.sonqo.io/partner/{partnerId}/subscriptions/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true
}{
"success": false,
"code": "PARTNER.TEST_PARTNER_SUBSCRIPTION_ERROR",
"message": "Error sending test webhook to some subscriptions"
}Este endpoint enviará un evento de prueba a la URL de webhook configurada para el partner, para que puedan probar que la integración está funcionando correctamente.
La notificación es de tipo
Puedes ver en las cabercas de la petición el
POST.
Ejemplo de notificación
{
"test": true,
"event": "chargeback.created",
"data": {
"message": "Test webhook"
}
}
x-hmac-hash que es el hash de la petición que se envía para que el partner pueda validar que la petición es auténtica.
Por ejemplo:
POST /webhook/sample HTTP/1.1
Host: api.example.com
Content-Type: application/json
x-hmac-hash: 5d0a63628669ebc76cf3d5d33a0da3a3c96bd519fa129534b50e0f3ae97027d3
Kausanna usa el algoritmo SHA256 para generar el hash de la petición.

