curl --request PUT \
--url https://api.xpaycheckout.com/webhook/{webhookConfigId} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"eventSigner": "secret_key",
"endpoint": "https://your-webhook-endpoint.com/webhook",
"subscribedEventTypes": [
"intent.created",
"intent.success",
"intent.failed",
"intent.refunded",
"intent.checkout_opened",
"subscription.trialing",
"subscription.cycle_charged"
]
}
'import requests
url = "https://api.xpaycheckout.com/webhook/{webhookConfigId}"
payload = {
"eventSigner": "secret_key",
"endpoint": "https://your-webhook-endpoint.com/webhook",
"subscribedEventTypes": ["intent.created", "intent.success", "intent.failed", "intent.refunded", "intent.checkout_opened", "subscription.trialing", "subscription.cycle_charged"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
eventSigner: 'secret_key',
endpoint: 'https://your-webhook-endpoint.com/webhook',
subscribedEventTypes: [
'intent.created',
'intent.success',
'intent.failed',
'intent.refunded',
'intent.checkout_opened',
'subscription.trialing',
'subscription.cycle_charged'
]
})
};
fetch('https://api.xpaycheckout.com/webhook/{webhookConfigId}', 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.xpaycheckout.com/webhook/{webhookConfigId}",
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([
'eventSigner' => 'secret_key',
'endpoint' => 'https://your-webhook-endpoint.com/webhook',
'subscribedEventTypes' => [
'intent.created',
'intent.success',
'intent.failed',
'intent.refunded',
'intent.checkout_opened',
'subscription.trialing',
'subscription.cycle_charged'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.xpaycheckout.com/webhook/{webhookConfigId}"
payload := strings.NewReader("{\n \"eventSigner\": \"secret_key\",\n \"endpoint\": \"https://your-webhook-endpoint.com/webhook\",\n \"subscribedEventTypes\": [\n \"intent.created\",\n \"intent.success\",\n \"intent.failed\",\n \"intent.refunded\",\n \"intent.checkout_opened\",\n \"subscription.trialing\",\n \"subscription.cycle_charged\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.xpaycheckout.com/webhook/{webhookConfigId}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"eventSigner\": \"secret_key\",\n \"endpoint\": \"https://your-webhook-endpoint.com/webhook\",\n \"subscribedEventTypes\": [\n \"intent.created\",\n \"intent.success\",\n \"intent.failed\",\n \"intent.refunded\",\n \"intent.checkout_opened\",\n \"subscription.trialing\",\n \"subscription.cycle_charged\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xpaycheckout.com/webhook/{webhookConfigId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventSigner\": \"secret_key\",\n \"endpoint\": \"https://your-webhook-endpoint.com/webhook\",\n \"subscribedEventTypes\": [\n \"intent.created\",\n \"intent.success\",\n \"intent.failed\",\n \"intent.refunded\",\n \"intent.checkout_opened\",\n \"subscription.trialing\",\n \"subscription.cycle_charged\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"errorCode": "bad_request",
"errorDescription": "Failed to read request"
}Edit Webhook Configuration
Update an existing webhook configuration. Use this to rotate the event signer, change the destination endpoint, or adjust the subscribed event types.
curl --request PUT \
--url https://api.xpaycheckout.com/webhook/{webhookConfigId} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"eventSigner": "secret_key",
"endpoint": "https://your-webhook-endpoint.com/webhook",
"subscribedEventTypes": [
"intent.created",
"intent.success",
"intent.failed",
"intent.refunded",
"intent.checkout_opened",
"subscription.trialing",
"subscription.cycle_charged"
]
}
'import requests
url = "https://api.xpaycheckout.com/webhook/{webhookConfigId}"
payload = {
"eventSigner": "secret_key",
"endpoint": "https://your-webhook-endpoint.com/webhook",
"subscribedEventTypes": ["intent.created", "intent.success", "intent.failed", "intent.refunded", "intent.checkout_opened", "subscription.trialing", "subscription.cycle_charged"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
eventSigner: 'secret_key',
endpoint: 'https://your-webhook-endpoint.com/webhook',
subscribedEventTypes: [
'intent.created',
'intent.success',
'intent.failed',
'intent.refunded',
'intent.checkout_opened',
'subscription.trialing',
'subscription.cycle_charged'
]
})
};
fetch('https://api.xpaycheckout.com/webhook/{webhookConfigId}', 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.xpaycheckout.com/webhook/{webhookConfigId}",
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([
'eventSigner' => 'secret_key',
'endpoint' => 'https://your-webhook-endpoint.com/webhook',
'subscribedEventTypes' => [
'intent.created',
'intent.success',
'intent.failed',
'intent.refunded',
'intent.checkout_opened',
'subscription.trialing',
'subscription.cycle_charged'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.xpaycheckout.com/webhook/{webhookConfigId}"
payload := strings.NewReader("{\n \"eventSigner\": \"secret_key\",\n \"endpoint\": \"https://your-webhook-endpoint.com/webhook\",\n \"subscribedEventTypes\": [\n \"intent.created\",\n \"intent.success\",\n \"intent.failed\",\n \"intent.refunded\",\n \"intent.checkout_opened\",\n \"subscription.trialing\",\n \"subscription.cycle_charged\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.xpaycheckout.com/webhook/{webhookConfigId}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"eventSigner\": \"secret_key\",\n \"endpoint\": \"https://your-webhook-endpoint.com/webhook\",\n \"subscribedEventTypes\": [\n \"intent.created\",\n \"intent.success\",\n \"intent.failed\",\n \"intent.refunded\",\n \"intent.checkout_opened\",\n \"subscription.trialing\",\n \"subscription.cycle_charged\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.xpaycheckout.com/webhook/{webhookConfigId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventSigner\": \"secret_key\",\n \"endpoint\": \"https://your-webhook-endpoint.com/webhook\",\n \"subscribedEventTypes\": [\n \"intent.created\",\n \"intent.success\",\n \"intent.failed\",\n \"intent.refunded\",\n \"intent.checkout_opened\",\n \"subscription.trialing\",\n \"subscription.cycle_charged\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"errorCode": "bad_request",
"errorDescription": "Failed to read request"
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Headers
A unique key for making the request idempotent. Must match pattern: ^[a-zA-Z0-9\-_:\.]+$. See Idempotent Requests for more details.
255^[a-zA-Z0-9\-_:\.]+$Path Parameters
Identifier of the webhook configuration to update
Body
Secret used to sign outbound webhook events. Provide a value that you will use to verify the signature.
"secret_key"
Public HTTPS URL where xPay should POST webhook events.
"https://your-webhook-endpoint.com/webhook"
List of event types to subscribe to. Refer to webhook events for the full list of available events.
[
"intent.created",
"intent.success",
"intent.failed",
"intent.refunded",
"intent.checkout_opened",
"subscription.trialing",
"subscription.cycle_charged"
]
Response
Webhook configuration updated successfully. No content is returned.
Was this page helpful?