Webhooks
Déclencher un webhook de test
Trigger a test event to mimic a webhook event at a given URL.
POST
/
v2
/
webhooks
/
test
Trigger a test webhook
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/webhooks/test \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"event": "order.authorized",
"url": "https://example.com/webhooks"
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/webhooks/test"
payload = {
"event": "order.authorized",
"url": "https://example.com/webhooks"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({event: 'order.authorized', url: 'https://example.com/webhooks'})
};
fetch('https://sandbox.gateway.sezzle.com/v2/webhooks/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://sandbox.gateway.sezzle.com/v2/webhooks/test",
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([
'event' => 'order.authorized',
'url' => 'https://example.com/webhooks'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://sandbox.gateway.sezzle.com/v2/webhooks/test"
payload := strings.NewReader("{\n \"event\": \"order.authorized\",\n \"url\": \"https://example.com/webhooks\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.gateway.sezzle.com/v2/webhooks/test")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"order.authorized\",\n \"url\": \"https://example.com/webhooks\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/webhooks/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"order.authorized\",\n \"url\": \"https://example.com/webhooks\"\n}"
response = http.request(request)
puts response.read_body[
{
"code": "bad_request",
"message": "bad request"
}
][
{
"code": "unauthorized",
"message": "authorization not accepted"
}
][
{
"code": "record_not_found",
"message": "not found"
}
][
{
"code": "invalid",
"message": "Unprocessable entity"
}
]Événements Webhook valides
Nous acceptons les événements Webhook suivants| Événement | Déclencheur |
|---|---|
customer.tokenized | Un client est tokenisé |
order.authorized | Une commande est autorisée par Sezzle |
order.captured | Une commande est capturée par Sezzle |
order.refunded | Une commande est remboursée par Sezzle |
dispute.merchant_input_requested | Un litige est déposé par un acheteur et la contribution du marchand est requise |
dispute.deadline_approaching | Un litige est transféré en avis final par Sezzle |
dispute.closed.customer_win | L’acheteur gagne le litige et la commande est remboursée |
dispute.closed.merchant_win | Le marchand gagne le litige et il est résolu en sa faveur |
dispute.closed.neutral | Aucun gagnant clair n’est déterminé et le litige est résolu de manière neutre |
Autorisations
The authentication token generated from providing API Keys to Sezzle Gateway
Corps
application/json
One of the Valid Webhook Events
Options disponibles:
customer.tokenized, order.authorized, order.captured, order.refunded, dispute.merchant_input_requested, dispute.deadline_approaching, dispute.closed.customer_win, dispute.closed.merchant_win, dispute.closed.neutral A url to receive the test webhook. If omitted, the test webhook is sent to all urls subscribed to that event.
Réponse
Status Created
⌘I
Trigger a test webhook
curl --request POST \
--url https://sandbox.gateway.sezzle.com/v2/webhooks/test \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"event": "order.authorized",
"url": "https://example.com/webhooks"
}
'import requests
url = "https://sandbox.gateway.sezzle.com/v2/webhooks/test"
payload = {
"event": "order.authorized",
"url": "https://example.com/webhooks"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({event: 'order.authorized', url: 'https://example.com/webhooks'})
};
fetch('https://sandbox.gateway.sezzle.com/v2/webhooks/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://sandbox.gateway.sezzle.com/v2/webhooks/test",
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([
'event' => 'order.authorized',
'url' => 'https://example.com/webhooks'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://sandbox.gateway.sezzle.com/v2/webhooks/test"
payload := strings.NewReader("{\n \"event\": \"order.authorized\",\n \"url\": \"https://example.com/webhooks\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.gateway.sezzle.com/v2/webhooks/test")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"order.authorized\",\n \"url\": \"https://example.com/webhooks\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.gateway.sezzle.com/v2/webhooks/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"order.authorized\",\n \"url\": \"https://example.com/webhooks\"\n}"
response = http.request(request)
puts response.read_body[
{
"code": "bad_request",
"message": "bad request"
}
][
{
"code": "unauthorized",
"message": "authorization not accepted"
}
][
{
"code": "record_not_found",
"message": "not found"
}
][
{
"code": "invalid",
"message": "Unprocessable entity"
}
]