Update
curl --request PUT \
--url https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": "<string>",
"url": "<string>",
"secret": "<string>",
"account_id": 123
}
'import requests
url = "https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks"
payload = {
"event": "<string>",
"url": "<string>",
"secret": "<string>",
"account_id": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({event: '<string>', url: '<string>', secret: '<string>', account_id: 123})
};
fetch('https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks', 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.sandbox.wepayout.com.br/v2/register/companies/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'event' => '<string>',
'url' => '<string>',
'secret' => '<string>',
'account_id' => 123
]),
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.sandbox.wepayout.com.br/v2/register/companies/webhooks"
payload := strings.NewReader("{\n \"event\": \"<string>\",\n \"url\": \"<string>\",\n \"secret\": \"<string>\",\n \"account_id\": 123\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"<string>\",\n \"url\": \"<string>\",\n \"secret\": \"<string>\",\n \"account_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"<string>\",\n \"url\": \"<string>\",\n \"secret\": \"<string>\",\n \"account_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"account_id": 4521,
"event": "onboarding",
"url": "https://my-url.requestcatcher.com/test",
"secret": "whsec_9f8e7d6c5b4a3210"
}
{
"message": "Webhook not found."
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"account_id": ["The account does not exist or is not linked to your merchant."]
},
"field_errors": [
{
"field": "account_id",
"code": "invalid_account",
"params": [],
"message": "The account does not exist or is not linked to your merchant."
}
]
}
Webhook
Update
Update an existing webhook configuration
PUT
/
v2
/
register
/
companies
/
webhooks
Update
curl --request PUT \
--url https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": "<string>",
"url": "<string>",
"secret": "<string>",
"account_id": 123
}
'import requests
url = "https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks"
payload = {
"event": "<string>",
"url": "<string>",
"secret": "<string>",
"account_id": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({event: '<string>', url: '<string>', secret: '<string>', account_id: 123})
};
fetch('https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks', 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.sandbox.wepayout.com.br/v2/register/companies/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'event' => '<string>',
'url' => '<string>',
'secret' => '<string>',
'account_id' => 123
]),
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.sandbox.wepayout.com.br/v2/register/companies/webhooks"
payload := strings.NewReader("{\n \"event\": \"<string>\",\n \"url\": \"<string>\",\n \"secret\": \"<string>\",\n \"account_id\": 123\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"<string>\",\n \"url\": \"<string>\",\n \"secret\": \"<string>\",\n \"account_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"<string>\",\n \"url\": \"<string>\",\n \"secret\": \"<string>\",\n \"account_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"account_id": 4521,
"event": "onboarding",
"url": "https://my-url.requestcatcher.com/test",
"secret": "whsec_9f8e7d6c5b4a3210"
}
{
"message": "Webhook not found."
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"account_id": ["The account does not exist or is not linked to your merchant."]
},
"field_errors": [
{
"field": "account_id",
"code": "invalid_account",
"params": [],
"message": "The account does not exist or is not linked to your merchant."
}
]
}
Update Webhook URL
This endpoint allows updating the webhook URL and signing secret associated with a specific event.- The webhook is identified by the
eventand the optionalaccount_id, both sent in the request body. The path never carries the event - The request body should include the new configuration values for the specified event’s webhook URL
Registering, updating or removing a webhook may take up to 5 minutes to take effect. Until then, webhooks keep being delivered to the previous destination.
Request Body
string
required
The event type whose webhook will be updated. Together with
account_id, it identifies the webhook.Allowed values: onboarding, payin, payout, kycExample: onboardingstring
required
Endpoint URL that will receive the webhook notifications for the selected event.URL characters:
a-z, A-Z charactersMaximum length: 120 charactersExample: https://my-url.requestcatcher.com/teststring
Secret used to sign the
payin, payout and kyc webhooks with HMAC-SHA256. When provided, every webhook for this event includes the x-webhook-wp-signature header.Maximum length: 255 characters. Use a long, randomly generated value.Example: whsec_9f8e7d6c5b4a3210integer
ID of the account whose webhook will be updated: your own merchant or one of its subaccounts.When omitted, the webhook of your merchant (the authenticated account) is updated.If the account does not exist or is not linked to your merchant, the request fails with
422 and the invalid_account code. If the account has no webhook for the event, the request fails with 404.Example: 4521Without
account_id, the update always targets your merchant, even if the webhook you want to change was listed by Query under a subaccount. Send the account_id returned with the webhook to update the right one.The update replaces the whole configuration. If
secret is omitted or null, the current secret is removed and the webhooks are no longer signed. Always send the secret you want to keep.To rotate the secret, send the new value in
secret. Changes may take up to 5 minutes to take effect, so accept signatures computed with either the old or the new secret during this period.Response
integer
ID of the account the webhook belongs to.Example:
4521string
Type of event that was registered for the webhookAllowed values:
onboarding, payin, payout, kycstring
Endpoint URL that was registered to receive webhook notificationsExample:
https://my-url.com/teststring
Secret used to sign the webhooks for this event, or
null if none is set.Example: whsec_9f8e7d6c5b4a3210Request Example
curl --request PUT \
--url https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"event": "onboarding",
"url": "https://my-url.requestcatcher.com/test",
"secret": "whsec_9f8e7d6c5b4a3210",
"account_id": 4521
}'
const response = await fetch('https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks', {
method: 'PUT',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: 'onboarding',
url: 'https://my-url.requestcatcher.com/test',
secret: 'whsec_9f8e7d6c5b4a3210',
account_id: 4521
})
});
const data = await response.json();
console.log(data);
import requests
url = 'https://api.sandbox.wepayout.com.br/v2/register/companies/webhooks'
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
data = {
'event': 'onboarding',
'url': 'https://my-url.requestcatcher.com/test',
'secret': 'whsec_9f8e7d6c5b4a3210',
'account_id': 4521
}
response = requests.put(url, json=data, headers=headers)
print(response.json())
{
"account_id": 4521,
"event": "onboarding",
"url": "https://my-url.requestcatcher.com/test",
"secret": "whsec_9f8e7d6c5b4a3210"
}
{
"message": "Webhook not found."
}
{
"error_code": "validation",
"error_description": "Validation error",
"fields": {
"account_id": ["The account does not exist or is not linked to your merchant."]
},
"field_errors": [
{
"field": "account_id",
"code": "invalid_account",
"params": [],
"message": "The account does not exist or is not linked to your merchant."
}
]
}
Was this page helpful?

