diff --git a/dist/api/webhook-events/fetch/requests.js b/dist/api/webhook-events/fetch/requests.js new file mode 100644 index 0000000..301ab88 --- /dev/null +++ b/dist/api/webhook-events/fetch/requests.js @@ -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 = ` "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} \ No newline at end of file diff --git a/dist/api/webhook-events/fetch/response.json b/dist/api/webhook-events/fetch/response.json new file mode 100644 index 0000000..5afa81f --- /dev/null +++ b/dist/api/webhook-events/fetch/response.json @@ -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" + } + } +} diff --git a/dist/api/webhook-events/list/requests.js b/dist/api/webhook-events/list/requests.js new file mode 100644 index 0000000..c948cfb --- /dev/null +++ b/dist/api/webhook-events/list/requests.js @@ -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 = ` "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} \ No newline at end of file diff --git a/dist/api/webhook-events/list/response.json b/dist/api/webhook-events/list/response.json new file mode 100644 index 0000000..4b5d64b --- /dev/null +++ b/dist/api/webhook-events/list/response.json @@ -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" + } + } +} diff --git a/dist/api/webhook-events/lookup/requests.js b/dist/api/webhook-events/lookup/requests.js new file mode 100644 index 0000000..7e8ef65 --- /dev/null +++ b/dist/api/webhook-events/lookup/requests.js @@ -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 = ` "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} \ No newline at end of file diff --git a/dist/api/webhook-events/lookup/response.json b/dist/api/webhook-events/lookup/response.json new file mode 100644 index 0000000..950caf1 --- /dev/null +++ b/dist/api/webhook-events/lookup/response.json @@ -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" + } + } +} diff --git a/dist/api/webhook-events/resend-matching/requests.js b/dist/api/webhook-events/resend-matching/requests.js new file mode 100644 index 0000000..7134a12 --- /dev/null +++ b/dist/api/webhook-events/resend-matching/requests.js @@ -0,0 +1,89 @@ +const sh = `#!/bin/sh +url="https://api.paystack.co/integration/webhooks/events/resend-matching" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "filters": { + "status": "Failed", + "category": "transactions", + "event_type": "charge.success", + "from": "2026-07-01", + "to": "2026-07-09" + } +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST` + +const js = `const https = require('https') + +const params = JSON.stringify({ + "filters": { + "status": "Failed", + "category": "transactions", + "event_type": "charge.success", + "from": "2026-07-01", + "to": "2026-07-09" + } +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/integration/webhooks/events/resend-matching', + method: 'POST', + headers: { + Authorization: 'Bearer SECRET_KEY', + 'Content-Type': 'application/json' + } +} + +const req = 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) +}) + +req.write(params) +req.end()` + +const php = ` [ + "status" => "Failed", + "category" => "transactions", + "event_type" => "charge.success", + "from" => "2026-07-01", + "to" => "2026-07-09" + ] +]; + +$fields_string = json_encode($fields); + +$ch = curl_init(); + +curl_setopt($ch, CURLOPT_URL, $url); +curl_setopt($ch, CURLOPT_POST, true); +curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); +curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Authorization: Bearer SECRET_KEY", + "Content-Type: application/json", + "Cache-Control: no-cache", +)); + +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + +$result = curl_exec($ch); +echo $result; +?>` + +export {sh, js, php} \ No newline at end of file diff --git a/dist/api/webhook-events/resend-matching/response.json b/dist/api/webhook-events/resend-matching/response.json new file mode 100644 index 0000000..70d52fa --- /dev/null +++ b/dist/api/webhook-events/resend-matching/response.json @@ -0,0 +1,38 @@ +{ + "200": { + "description": "200 Ok (preview=true)", + "data": { + "status": true, + "message": "Preview", + "data": { + "count": 128 + } + } + }, + "202": { + "description": "202 Accepted", + "data": { + "status": true, + "message": "Resend accepted", + "data": { + "count": 128, + "skipped": 0, + "batch_id": "rbatch_77cd41" + } + } + }, + "429": { + "description": "429 Too Many Requests", + "data": { + "status": false, + "message": "Resend rate limit exceeded, please try again later" + } + }, + "500": { + "description": "500 Internal Server Error", + "data": { + "status": false, + "message": "Something went wrong" + } + } +} diff --git a/dist/api/webhook-events/resend/requests.js b/dist/api/webhook-events/resend/requests.js new file mode 100644 index 0000000..c06fc21 --- /dev/null +++ b/dist/api/webhook-events/resend/requests.js @@ -0,0 +1,71 @@ +const sh = `#!/bin/sh +url="https://api.paystack.co/integration/webhooks/events/resend" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "ids": ["665f1c2a9d1e4b0012a3c4d5", "665a0b119d1e4b0012a3bd90"] +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST` + +const js = `const https = require('https') + +const params = JSON.stringify({ + "ids": ["665f1c2a9d1e4b0012a3c4d5", "665a0b119d1e4b0012a3bd90"] +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/integration/webhooks/events/resend', + method: 'POST', + headers: { + Authorization: 'Bearer SECRET_KEY', + 'Content-Type': 'application/json' + } +} + +const req = 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) +}) + +req.write(params) +req.end()` + +const php = ` ["665f1c2a9d1e4b0012a3c4d5", "665a0b119d1e4b0012a3bd90"] +]; + +$fields_string = json_encode($fields); + +$ch = curl_init(); + +curl_setopt($ch, CURLOPT_URL, $url); +curl_setopt($ch, CURLOPT_POST, true); +curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); +curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Authorization: Bearer SECRET_KEY", + "Content-Type: application/json", + "Cache-Control: no-cache", +)); + +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + +$result = curl_exec($ch); +echo $result; +?>` + +export {sh, js, php} \ No newline at end of file diff --git a/dist/api/webhook-events/resend/response.json b/dist/api/webhook-events/resend/response.json new file mode 100644 index 0000000..d646bc3 --- /dev/null +++ b/dist/api/webhook-events/resend/response.json @@ -0,0 +1,28 @@ +{ + "202": { + "description": "202 Accepted", + "data": { + "status": true, + "message": "Resend accepted", + "data": { + "count": 2, + "failed": 0, + "failed_ids": [] + } + } + }, + "400": { + "description": "400 Bad Request", + "data": { + "status": false, + "message": "ids must be a non-empty array" + } + }, + "500": { + "description": "500 Internal Server Error", + "data": { + "status": false, + "message": "Something went wrong" + } + } +} diff --git a/src/api/webhook-events/fetch/config.yml b/src/api/webhook-events/fetch/config.yml new file mode 100644 index 0000000..04cb6ab --- /dev/null +++ b/src/api/webhook-events/fetch/config.yml @@ -0,0 +1,4 @@ +languages: + - sh + - js + - php diff --git a/src/api/webhook-events/fetch/index.js b/src/api/webhook-events/fetch/index.js new file mode 100644 index 0000000..f15f6ff --- /dev/null +++ b/src/api/webhook-events/fetch/index.js @@ -0,0 +1,25 @@ +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) +}) \ No newline at end of file diff --git a/src/api/webhook-events/fetch/index.php b/src/api/webhook-events/fetch/index.php new file mode 100644 index 0000000..694452e --- /dev/null +++ b/src/api/webhook-events/fetch/index.php @@ -0,0 +1,28 @@ + "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; + } +?> \ No newline at end of file diff --git a/src/api/webhook-events/fetch/index.sh b/src/api/webhook-events/fetch/index.sh new file mode 100644 index 0000000..7353510 --- /dev/null +++ b/src/api/webhook-events/fetch/index.sh @@ -0,0 +1,5 @@ +#!/bin/sh +url="https://api.paystack.co/integration/webhooks/events/665f1c2a9d1e4b0012a3c4d5" +authorization="Authorization: Bearer YOUR_SECRET_KEY" + +curl "$url" -H "$authorization" -X GET \ No newline at end of file diff --git a/src/api/webhook-events/fetch/response.json b/src/api/webhook-events/fetch/response.json new file mode 100644 index 0000000..5afa81f --- /dev/null +++ b/src/api/webhook-events/fetch/response.json @@ -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" + } + } +} diff --git a/src/api/webhook-events/list/config.yml b/src/api/webhook-events/list/config.yml new file mode 100644 index 0000000..04cb6ab --- /dev/null +++ b/src/api/webhook-events/list/config.yml @@ -0,0 +1,4 @@ +languages: + - sh + - js + - php diff --git a/src/api/webhook-events/list/index.js b/src/api/webhook-events/list/index.js new file mode 100644 index 0000000..c711285 --- /dev/null +++ b/src/api/webhook-events/list/index.js @@ -0,0 +1,25 @@ +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) +}) \ No newline at end of file diff --git a/src/api/webhook-events/list/index.php b/src/api/webhook-events/list/index.php new file mode 100644 index 0000000..7f52579 --- /dev/null +++ b/src/api/webhook-events/list/index.php @@ -0,0 +1,28 @@ + "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; + } +?> \ No newline at end of file diff --git a/src/api/webhook-events/list/index.sh b/src/api/webhook-events/list/index.sh new file mode 100644 index 0000000..fcbc82e --- /dev/null +++ b/src/api/webhook-events/list/index.sh @@ -0,0 +1,5 @@ +#!/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 \ No newline at end of file diff --git a/src/api/webhook-events/list/response.json b/src/api/webhook-events/list/response.json new file mode 100644 index 0000000..4b5d64b --- /dev/null +++ b/src/api/webhook-events/list/response.json @@ -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" + } + } +} diff --git a/src/api/webhook-events/lookup/config.yml b/src/api/webhook-events/lookup/config.yml new file mode 100644 index 0000000..04cb6ab --- /dev/null +++ b/src/api/webhook-events/lookup/config.yml @@ -0,0 +1,4 @@ +languages: + - sh + - js + - php diff --git a/src/api/webhook-events/lookup/index.js b/src/api/webhook-events/lookup/index.js new file mode 100644 index 0000000..607c814 --- /dev/null +++ b/src/api/webhook-events/lookup/index.js @@ -0,0 +1,25 @@ +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) +}) \ No newline at end of file diff --git a/src/api/webhook-events/lookup/index.php b/src/api/webhook-events/lookup/index.php new file mode 100644 index 0000000..e5772b6 --- /dev/null +++ b/src/api/webhook-events/lookup/index.php @@ -0,0 +1,28 @@ + "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; + } +?> \ No newline at end of file diff --git a/src/api/webhook-events/lookup/index.sh b/src/api/webhook-events/lookup/index.sh new file mode 100644 index 0000000..82ca122 --- /dev/null +++ b/src/api/webhook-events/lookup/index.sh @@ -0,0 +1,5 @@ +#!/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 \ No newline at end of file diff --git a/src/api/webhook-events/lookup/response.json b/src/api/webhook-events/lookup/response.json new file mode 100644 index 0000000..950caf1 --- /dev/null +++ b/src/api/webhook-events/lookup/response.json @@ -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" + } + } +} diff --git a/src/api/webhook-events/resend-matching/config.yml b/src/api/webhook-events/resend-matching/config.yml new file mode 100644 index 0000000..04cb6ab --- /dev/null +++ b/src/api/webhook-events/resend-matching/config.yml @@ -0,0 +1,4 @@ +languages: + - sh + - js + - php diff --git a/src/api/webhook-events/resend-matching/index.js b/src/api/webhook-events/resend-matching/index.js new file mode 100644 index 0000000..9902bde --- /dev/null +++ b/src/api/webhook-events/resend-matching/index.js @@ -0,0 +1,39 @@ +const https = require('https') + +const params = JSON.stringify({ + "filters": { + "status": "Failed", + "category": "transactions", + "event_type": "charge.success", + "from": "2026-07-01", + "to": "2026-07-09" + } +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/integration/webhooks/events/resend-matching', + method: 'POST', + headers: { + Authorization: 'Bearer SECRET_KEY', + 'Content-Type': 'application/json' + } +} + +const req = 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) +}) + +req.write(params) +req.end() \ No newline at end of file diff --git a/src/api/webhook-events/resend-matching/index.php b/src/api/webhook-events/resend-matching/index.php new file mode 100644 index 0000000..34086b9 --- /dev/null +++ b/src/api/webhook-events/resend-matching/index.php @@ -0,0 +1,31 @@ + [ + "status" => "Failed", + "category" => "transactions", + "event_type" => "charge.success", + "from" => "2026-07-01", + "to" => "2026-07-09" + ] +]; + +$fields_string = json_encode($fields); + +$ch = curl_init(); + +curl_setopt($ch, CURLOPT_URL, $url); +curl_setopt($ch, CURLOPT_POST, true); +curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); +curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Authorization: Bearer SECRET_KEY", + "Content-Type: application/json", + "Cache-Control: no-cache", +)); + +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + +$result = curl_exec($ch); +echo $result; +?> \ No newline at end of file diff --git a/src/api/webhook-events/resend-matching/index.sh b/src/api/webhook-events/resend-matching/index.sh new file mode 100644 index 0000000..67605df --- /dev/null +++ b/src/api/webhook-events/resend-matching/index.sh @@ -0,0 +1,15 @@ +#!/bin/sh +url="https://api.paystack.co/integration/webhooks/events/resend-matching" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "filters": { + "status": "Failed", + "category": "transactions", + "event_type": "charge.success", + "from": "2026-07-01", + "to": "2026-07-09" + } +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST \ No newline at end of file diff --git a/src/api/webhook-events/resend-matching/response.json b/src/api/webhook-events/resend-matching/response.json new file mode 100644 index 0000000..70d52fa --- /dev/null +++ b/src/api/webhook-events/resend-matching/response.json @@ -0,0 +1,38 @@ +{ + "200": { + "description": "200 Ok (preview=true)", + "data": { + "status": true, + "message": "Preview", + "data": { + "count": 128 + } + } + }, + "202": { + "description": "202 Accepted", + "data": { + "status": true, + "message": "Resend accepted", + "data": { + "count": 128, + "skipped": 0, + "batch_id": "rbatch_77cd41" + } + } + }, + "429": { + "description": "429 Too Many Requests", + "data": { + "status": false, + "message": "Resend rate limit exceeded, please try again later" + } + }, + "500": { + "description": "500 Internal Server Error", + "data": { + "status": false, + "message": "Something went wrong" + } + } +} diff --git a/src/api/webhook-events/resend/config.yml b/src/api/webhook-events/resend/config.yml new file mode 100644 index 0000000..04cb6ab --- /dev/null +++ b/src/api/webhook-events/resend/config.yml @@ -0,0 +1,4 @@ +languages: + - sh + - js + - php diff --git a/src/api/webhook-events/resend/index.js b/src/api/webhook-events/resend/index.js new file mode 100644 index 0000000..31f1507 --- /dev/null +++ b/src/api/webhook-events/resend/index.js @@ -0,0 +1,33 @@ +const https = require('https') + +const params = JSON.stringify({ + "ids": ["665f1c2a9d1e4b0012a3c4d5", "665a0b119d1e4b0012a3bd90"] +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/integration/webhooks/events/resend', + method: 'POST', + headers: { + Authorization: 'Bearer SECRET_KEY', + 'Content-Type': 'application/json' + } +} + +const req = 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) +}) + +req.write(params) +req.end() \ No newline at end of file diff --git a/src/api/webhook-events/resend/index.php b/src/api/webhook-events/resend/index.php new file mode 100644 index 0000000..5c2f316 --- /dev/null +++ b/src/api/webhook-events/resend/index.php @@ -0,0 +1,25 @@ + ["665f1c2a9d1e4b0012a3c4d5", "665a0b119d1e4b0012a3bd90"] +]; + +$fields_string = json_encode($fields); + +$ch = curl_init(); + +curl_setopt($ch, CURLOPT_URL, $url); +curl_setopt($ch, CURLOPT_POST, true); +curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); +curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Authorization: Bearer SECRET_KEY", + "Content-Type: application/json", + "Cache-Control: no-cache", +)); + +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + +$result = curl_exec($ch); +echo $result; +?> \ No newline at end of file diff --git a/src/api/webhook-events/resend/index.sh b/src/api/webhook-events/resend/index.sh new file mode 100644 index 0000000..2e9a80b --- /dev/null +++ b/src/api/webhook-events/resend/index.sh @@ -0,0 +1,9 @@ +#!/bin/sh +url="https://api.paystack.co/integration/webhooks/events/resend" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "ids": ["665f1c2a9d1e4b0012a3c4d5", "665a0b119d1e4b0012a3bd90"] +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST \ No newline at end of file diff --git a/src/api/webhook-events/resend/response.json b/src/api/webhook-events/resend/response.json new file mode 100644 index 0000000..d646bc3 --- /dev/null +++ b/src/api/webhook-events/resend/response.json @@ -0,0 +1,28 @@ +{ + "202": { + "description": "202 Accepted", + "data": { + "status": true, + "message": "Resend accepted", + "data": { + "count": 2, + "failed": 0, + "failed_ids": [] + } + } + }, + "400": { + "description": "400 Bad Request", + "data": { + "status": false, + "message": "ids must be a non-empty array" + } + }, + "500": { + "description": "500 Internal Server Error", + "data": { + "status": false, + "message": "Something went wrong" + } + } +}