Paystack transfer & payment events webhook
curl --request POST \
--url https://api.royalti.io/paystack/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-paystack-signature: <x-paystack-signature>' \
--data '
{
"event": "transfer.success",
"data": {
"id": 123456,
"reference": "c0ffee00-0000-4000-8000-000000000001",
"transfer_code": "TRF_1ptvuv321aha76q",
"amount": 5000000,
"currency": "NGN",
"status": "success",
"transferred_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
'import requests
url = "https://api.royalti.io/paystack/webhook"
payload = {
"event": "transfer.success",
"data": {
"id": 123456,
"reference": "c0ffee00-0000-4000-8000-000000000001",
"transfer_code": "TRF_1ptvuv321aha76q",
"amount": 5000000,
"currency": "NGN",
"status": "success",
"transferred_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
headers = {
"x-paystack-signature": "<x-paystack-signature>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-paystack-signature': '<x-paystack-signature>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: 'transfer.success',
data: {
id: 123456,
reference: 'c0ffee00-0000-4000-8000-000000000001',
transfer_code: 'TRF_1ptvuv321aha76q',
amount: 5000000,
currency: 'NGN',
status: 'success',
transferred_at: '2023-11-07T05:31:56Z',
reason: '<string>'
}
})
};
fetch('https://api.royalti.io/paystack/webhook', 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.royalti.io/paystack/webhook",
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' => 'transfer.success',
'data' => [
'id' => 123456,
'reference' => 'c0ffee00-0000-4000-8000-000000000001',
'transfer_code' => 'TRF_1ptvuv321aha76q',
'amount' => 5000000,
'currency' => 'NGN',
'status' => 'success',
'transferred_at' => '2023-11-07T05:31:56Z',
'reason' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-paystack-signature: <x-paystack-signature>"
],
]);
$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.royalti.io/paystack/webhook"
payload := strings.NewReader("{\n \"event\": \"transfer.success\",\n \"data\": {\n \"id\": 123456,\n \"reference\": \"c0ffee00-0000-4000-8000-000000000001\",\n \"transfer_code\": \"TRF_1ptvuv321aha76q\",\n \"amount\": 5000000,\n \"currency\": \"NGN\",\n \"status\": \"success\",\n \"transferred_at\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-paystack-signature", "<x-paystack-signature>")
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.post("https://api.royalti.io/paystack/webhook")
.header("x-paystack-signature", "<x-paystack-signature>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"transfer.success\",\n \"data\": {\n \"id\": 123456,\n \"reference\": \"c0ffee00-0000-4000-8000-000000000001\",\n \"transfer_code\": \"TRF_1ptvuv321aha76q\",\n \"amount\": 5000000,\n \"currency\": \"NGN\",\n \"status\": \"success\",\n \"transferred_at\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/paystack/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-paystack-signature"] = '<x-paystack-signature>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"transfer.success\",\n \"data\": {\n \"id\": 123456,\n \"reference\": \"c0ffee00-0000-4000-8000-000000000001\",\n \"transfer_code\": \"TRF_1ptvuv321aha76q\",\n \"amount\": 5000000,\n \"currency\": \"NGN\",\n \"status\": \"success\",\n \"transferred_at\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"event": "transfer.success"
}{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}{
"status": "error",
"message": "Internal server error"
}Webhooks
Paystack transfer & payment events webhook
Receives asynchronous transfer status updates from Paystack for payout reconciliation.
POST
/
paystack
/
webhook
Paystack transfer & payment events webhook
curl --request POST \
--url https://api.royalti.io/paystack/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-paystack-signature: <x-paystack-signature>' \
--data '
{
"event": "transfer.success",
"data": {
"id": 123456,
"reference": "c0ffee00-0000-4000-8000-000000000001",
"transfer_code": "TRF_1ptvuv321aha76q",
"amount": 5000000,
"currency": "NGN",
"status": "success",
"transferred_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
'import requests
url = "https://api.royalti.io/paystack/webhook"
payload = {
"event": "transfer.success",
"data": {
"id": 123456,
"reference": "c0ffee00-0000-4000-8000-000000000001",
"transfer_code": "TRF_1ptvuv321aha76q",
"amount": 5000000,
"currency": "NGN",
"status": "success",
"transferred_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
headers = {
"x-paystack-signature": "<x-paystack-signature>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-paystack-signature': '<x-paystack-signature>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: 'transfer.success',
data: {
id: 123456,
reference: 'c0ffee00-0000-4000-8000-000000000001',
transfer_code: 'TRF_1ptvuv321aha76q',
amount: 5000000,
currency: 'NGN',
status: 'success',
transferred_at: '2023-11-07T05:31:56Z',
reason: '<string>'
}
})
};
fetch('https://api.royalti.io/paystack/webhook', 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.royalti.io/paystack/webhook",
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' => 'transfer.success',
'data' => [
'id' => 123456,
'reference' => 'c0ffee00-0000-4000-8000-000000000001',
'transfer_code' => 'TRF_1ptvuv321aha76q',
'amount' => 5000000,
'currency' => 'NGN',
'status' => 'success',
'transferred_at' => '2023-11-07T05:31:56Z',
'reason' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-paystack-signature: <x-paystack-signature>"
],
]);
$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.royalti.io/paystack/webhook"
payload := strings.NewReader("{\n \"event\": \"transfer.success\",\n \"data\": {\n \"id\": 123456,\n \"reference\": \"c0ffee00-0000-4000-8000-000000000001\",\n \"transfer_code\": \"TRF_1ptvuv321aha76q\",\n \"amount\": 5000000,\n \"currency\": \"NGN\",\n \"status\": \"success\",\n \"transferred_at\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-paystack-signature", "<x-paystack-signature>")
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.post("https://api.royalti.io/paystack/webhook")
.header("x-paystack-signature", "<x-paystack-signature>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"transfer.success\",\n \"data\": {\n \"id\": 123456,\n \"reference\": \"c0ffee00-0000-4000-8000-000000000001\",\n \"transfer_code\": \"TRF_1ptvuv321aha76q\",\n \"amount\": 5000000,\n \"currency\": \"NGN\",\n \"status\": \"success\",\n \"transferred_at\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.royalti.io/paystack/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-paystack-signature"] = '<x-paystack-signature>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"transfer.success\",\n \"data\": {\n \"id\": 123456,\n \"reference\": \"c0ffee00-0000-4000-8000-000000000001\",\n \"transfer_code\": \"TRF_1ptvuv321aha76q\",\n \"amount\": 5000000,\n \"currency\": \"NGN\",\n \"status\": \"success\",\n \"transferred_at\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"event": "transfer.success"
}{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}{
"status": "error",
"message": "Internal server error"
}Description
Authentication: Verified viax-paystack-signature header containing HMAC-SHA512 of the request body signed with the workspace’s BYO Paystack secret key.
Supported events:
transfer.success: Marks payment as completed and records completion timestamptransfer.failed: Marks payment as failed and reopens the linked payment request to pendingtransfer.reversed: Marks payment as reversed and reopens the linked payment request to pending
Code Examples
const response = await fetch('https://api.royalti.io/paystack/webhook', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"event": "transfer.success",
"data": {
"id": 123456,
"reference": "c0ffee00-0000-4000-8000-000000000001",
"transfer_code": "TRF_1ptvuv321aha76q",
"amount": 5000000,
"currency": "NGN",
"status": "success",
"transferred_at": "2024-01-21T12:00:00Z",
"reason": "sample-reason"
}
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://api.royalti.io/paystack/webhook',
json={"event":"transfer.success","data":{"id":123456,"reference":"c0ffee00-0000-4000-8000-000000000001","transfer_code":"TRF_1ptvuv321aha76q","amount":5000000,"currency":"NGN","status":"success","transferred_at":"2024-01-21T12:00:00Z","reason":"sample-reason"}}
)
data = response.json()
print(data)
curl -X POST https://api.royalti.io/paystack/webhook \
-H "Content-Type: application/json" \
-d '{"event":"transfer.success","data":{"id":123456,"reference":"c0ffee00-0000-4000-8000-000000000001","transfer_code":"TRF_1ptvuv321aha76q","amount":5000000,"currency":"NGN","status":"success","transferred_at":"2024-01-21T12:00:00Z","reason":"sample-reason"}}'
Authorizations
JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"
Headers
HMAC SHA512 signature of request body
Body
application/json
⌘I