curl --request PATCH \
--url https://api-sandbox.beinfi.com/account/webhooks/{endpointID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"isActive": true,
"events": [],
"active": true
}
'import requests
url = "https://api-sandbox.beinfi.com/account/webhooks/{endpointID}"
payload = {
"isActive": True,
"events": [],
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({isActive: true, events: [], active: true})
};
fetch('https://api-sandbox.beinfi.com/account/webhooks/{endpointID}', 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.beinfi.com/account/webhooks/{endpointID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'isActive' => true,
'events' => [
],
'active' => true
]),
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.beinfi.com/account/webhooks/{endpointID}"
payload := strings.NewReader("{\n \"isActive\": true,\n \"events\": [],\n \"active\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api-sandbox.beinfi.com/account/webhooks/{endpointID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"isActive\": true,\n \"events\": [],\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.beinfi.com/account/webhooks/{endpointID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"isActive\": true,\n \"events\": [],\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "we_3Tz8yU1oI4pA7sD0fG2hJk",
"url": "<string>",
"events": [
"<string>"
],
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"resource": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"errors": [
{
"field": "<string>",
"value": "<string>",
"constraint": "<string>",
"description": "<string>"
}
]
}Update a webhook
Changes the events, or turns the endpoint on or off. Send isActive, events or both; what is not sent stays as it is. events replaces the whole list. The URL and the secret do not change here (the secret changes with rotate-secret).
curl --request PATCH \
--url https://api-sandbox.beinfi.com/account/webhooks/{endpointID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"isActive": true,
"events": [],
"active": true
}
'import requests
url = "https://api-sandbox.beinfi.com/account/webhooks/{endpointID}"
payload = {
"isActive": True,
"events": [],
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({isActive: true, events: [], active: true})
};
fetch('https://api-sandbox.beinfi.com/account/webhooks/{endpointID}', 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.beinfi.com/account/webhooks/{endpointID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'isActive' => true,
'events' => [
],
'active' => true
]),
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.beinfi.com/account/webhooks/{endpointID}"
payload := strings.NewReader("{\n \"isActive\": true,\n \"events\": [],\n \"active\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api-sandbox.beinfi.com/account/webhooks/{endpointID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"isActive\": true,\n \"events\": [],\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.beinfi.com/account/webhooks/{endpointID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"isActive\": true,\n \"events\": [],\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "we_3Tz8yU1oI4pA7sD0fG2hJk",
"url": "<string>",
"events": [
"<string>"
],
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"resource": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"errors": [
{
"field": "<string>",
"value": "<string>",
"constraint": "<string>",
"description": "<string>"
}
]
}Authorizations
Your account's secret key: Authorization: Bearer sk_test_… or sk_live_…. Server-side only.
Headers
A unique key per operation (a UUID works). Retrying with the same key returns the original response.
Path Parameters
^we_[0-9A-Za-z]{22}$"we_3Tz8yU1oI4pA7sD0fG2hJk"
Body
true turns it on, false off. While off, the endpoint receives no deliveries.
The new list of events. At least one.
1checkout.session.created, checkout.session.completed, checkout.session.expired, customer.created, customer.converted, invoice.finalized, invoice.sent, invoice.paid, invoice.voided, invoice.uncollectible, invoice.auto_collection_failed, payment.confirmed, payment.failed, payment.refunded, payment.refund_reversed, payment.chargeback, payment.chargeback_reversed, plan.changed, usage.threshold_reached, credit.balance_low, credit.balance_depleted, subscription.cancel_scheduled, subscription.cancel_unscheduled, subscription.canceled, subscription.past_due, refund_request.created, payment.duplicate_detected, payment.duplicate_refunded, refund_request.declined Older spelling of isActive, still accepted.
Response
The updated endpoint.
^we_[0-9A-Za-z]{22}$"we_3Tz8yU1oI4pA7sD0fG2hJk"
URL that receives deliveries.
Subscribed events. Any emitted event can be subscribed to by name, including ones without a documented payload yet.
Whether the endpoint is receiving deliveries.