Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions dist/api/webhook-events/fetch/requests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const sh = `#!/bin/sh
url="https://api.paystack.co/integration/webhooks/events/665f1c2a9d1e4b0012a3c4d5"
authorization="Authorization: Bearer YOUR_SECRET_KEY"

curl "$url" -H "$authorization" -X GET`

const js = `const https = require('https')

const options = {
hostname: 'api.paystack.co',
port: 443,
path: '/integration/webhooks/events/665f1c2a9d1e4b0012a3c4d5',
method: 'GET',
headers: {
Authorization: 'Bearer SECRET_KEY'
}
}

https.request(options, res => {
let data = ''

res.on('data', (chunk) => {
data += chunk
});

res.on('end', () => {
console.log(JSON.parse(data))
})
}).on('error', error => {
console.error(error)
})`

const php = `<?php
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.paystack.co/integration/webhooks/events/665f1c2a9d1e4b0012a3c4d5",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer SECRET_KEY",
"Cache-Control: no-cache",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>`

export {sh, js, php}
40 changes: 40 additions & 0 deletions dist/api/webhook-events/fetch/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"200": {
"description": "200 Ok",
"data": {
"status": true,
"message": "Webhook Retrieved",
"data": {
"_id": "665f1c2a9d1e4b0012a3c4d5",
"domain": "live",
"category": "transactions",
"event_name": "charge.success",
"category_row_id": 4045667488,
"status": "Failed",
"status_detail": "retrying",
"response_code": 500,
"trial_count": 3,
"webhook_url": "https://example-merchant.com/hooks/paystack",
"webhook_url_code": null,
"event_payload": { "event": "charge.success", "data": { "id": 4045667488, "amount": 15300 } },
"merchant_response_body": "{\"error\":\"internal server error\"}",
"createdAt": "2026-07-09T15:17:00.000Z",
"updatedAt": "2026-07-09T15:42:00.000Z"
}
}
},
"404": {
"description": "404 Not Found",
"data": {
"status": false,
"message": "Webhook event not found"
}
},
"500": {
"description": "500 Internal Server Error",
"data": {
"status": false,
"message": "Something went wrong"
}
}
}
62 changes: 62 additions & 0 deletions dist/api/webhook-events/list/requests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const sh = `#!/bin/sh
url="https://api.paystack.co/integration/webhooks/events?status=Failed&limit=50"
authorization="Authorization: Bearer YOUR_SECRET_KEY"

curl "$url" -H "$authorization" -X GET`

const js = `const https = require('https')

const options = {
hostname: 'api.paystack.co',
port: 443,
path: '/integration/webhooks/events?status=Failed&limit=50',
method: 'GET',
headers: {
Authorization: 'Bearer SECRET_KEY'
}
}

https.request(options, res => {
let data = ''

res.on('data', (chunk) => {
data += chunk
});

res.on('end', () => {
console.log(JSON.parse(data))
})
}).on('error', error => {
console.error(error)
})`

const php = `<?php
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.paystack.co/integration/webhooks/events?status=Failed&limit=50",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer SECRET_KEY",
"Cache-Control: no-cache",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>`

export {sh, js, php}
39 changes: 39 additions & 0 deletions dist/api/webhook-events/list/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"200": {
"description": "200 Ok",
"data": {
"status": true,
"message": "Webhooks listed",
"data": [
{
"_id": "665f1c2a9d1e4b0012a3c4d5",
"domain": "live",
"category": "transactions",
"event_name": "charge.success",
"category_row_id": 4045667488,
"status": "Failed",
"status_detail": "retrying",
"response_code": 500,
"trial_count": 3,
"createdAt": "2026-07-09T15:17:00.000Z",
"updatedAt": "2026-07-09T15:42:00.000Z"
}
],
"meta": { "next": "cursor_next", "previous": null, "perPage": 50 }
}
},
"400": {
"description": "400 Bad Request",
"data": {
"status": false,
"message": "Invalid query: must be one of next or previous"
}
},
"500": {
"description": "500 Internal Server Error",
"data": {
"status": false,
"message": "Something went wrong"
}
}
}
62 changes: 62 additions & 0 deletions dist/api/webhook-events/lookup/requests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const sh = `#!/bin/sh
url="https://api.paystack.co/integration/webhooks/events/lookup?reference=4045667488"
authorization="Authorization: Bearer YOUR_SECRET_KEY"

curl "$url" -H "$authorization" -X GET`

const js = `const https = require('https')

const options = {
hostname: 'api.paystack.co',
port: 443,
path: '/integration/webhooks/events/lookup?reference=4045667488',
method: 'GET',
headers: {
Authorization: 'Bearer SECRET_KEY'
}
}

https.request(options, res => {
let data = ''

res.on('data', (chunk) => {
data += chunk
});

res.on('end', () => {
console.log(JSON.parse(data))
})
}).on('error', error => {
console.error(error)
})`

const php = `<?php
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.paystack.co/integration/webhooks/events/lookup?reference=4045667488",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer SECRET_KEY",
"Cache-Control: no-cache",
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>`

export {sh, js, php}
64 changes: 64 additions & 0 deletions dist/api/webhook-events/lookup/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"200": {
"description": "200 Ok",
"data": {
"status": true,
"message": "Webhook Retrieved",
"data": {
"_id": "6a759cc2289980000e46a716",
"domain": "test",
"category": "cardVerification",
"category_row_id": 5900551050,
"event_name": "zero_charge_authorization.failed",
"status": "Failed",
"status_detail": "failed",
"response_code": 404,
"trial_count": 10,
"createdAt": "2026-08-07T08:52:18.000Z",
"updatedAt": "2026-08-07T13:04:29.000Z",
"webhook_url": "https://example-merchant.com/hooks/paystack",
"webhook_url_code": null,
"event_payload": {
"event": "zero_charge_authorization.failed",
"data": {
"id": 5900551050,
"domain": "test",
"status": "failed",
"reference": "trx_rd227iwg",
"amount": 0,
"currency": "NGN",
"gateway_response": "No gateway was able to process the request"
}
},
"merchant_response_body": {
"success": false,
"error": {
"message": "Not found",
"id": ""
}
}
}
}
},
"400": {
"description": "400 Bad Request",
"data": {
"status": false,
"message": "reference is required"
}
},
"404": {
"description": "404 Not Found",
"data": {
"status": false,
"message": "Webhook event not found"
}
},
"500": {
"description": "500 Internal Server Error",
"data": {
"status": false,
"message": "Something went wrong"
}
}
}
Loading