diff --git a/dist/api/refunds/retry/requests.js b/dist/api/refunds/retry/requests.js new file mode 100644 index 0000000..ac40aa8 --- /dev/null +++ b/dist/api/refunds/retry/requests.js @@ -0,0 +1,87 @@ +const sh = `#!/bin/sh +url="https://api.paystack.co/refundretry_with_customer_details/{id}" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "refund_account_details": { + "currency": "NGN", + "account_number": "1234567890", + "bank_id": "9" + } +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST` + +const js = `const https = require('https') + +const params = JSON.stringify({ + "refund_account_details": { + "currency": "NGN", + "account_number": "1234567890", + "bank_id": "9" + } +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/refund/retry_with_customer_details/{id}', + 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 = ` 1641, + "refund_account_details" => [ + "currency" => "NGN", + "account_number" => "1234567890", + "bank_id" => "9" + ] +]; + +$fields_string = http_build_query($fields); + +//open connection +$ch = curl_init(); + +//set the url, number of POST vars, POST data +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", + "Cache-Control: no-cache", +)); + +//So that curl_exec returns the contents of the cURL; rather than echoing it +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + +//execute post +$result = curl_exec($ch); +echo $result; +` + +export {sh, js, php} \ No newline at end of file diff --git a/dist/api/refunds/retry/response.json b/dist/api/refunds/retry/response.json new file mode 100644 index 0000000..762a8e3 --- /dev/null +++ b/dist/api/refunds/retry/response.json @@ -0,0 +1,46 @@ +{ + "200": { + "description": "200 Ok", + "data": { + "status": true, + "message": "Refund retried and has been queued for processing", + "data": { + "integration": 123456, + "transaction": 3298598423, + "dispute": null, + "settlement": null, + "id": 1234567, + "domain": "live", + "currency": "NGN", + "amount": 20000, + "status": "processing", + "refunded_at": null, + "expected_at": "2025-10-13T16:02:18.000Z", + "channel": "isw_3ds", + "refunded_by": "paystack@email.com", + "customer_note": "Refund for transaction T708775813895475", + "merchant_note": "Refund for transaction T708775813895475 by paystack@email.com", + "deducted_amount": 20000, + "fully_deducted": true, + "bank_reference": null, + "reason": "PROCESSING", + "customer": null, + "initiated_by": "paystack@email.com", + "reversed_at": null, + "session_id": null + } + } + }, + "422": { + "description": "422", + "data": { + "status": false, + "message": "Invalid Refund state, refund status should be \"needs-attention\"", + "meta": { + "nextStep": "Ensure that the value(s) you're passing are valid." + }, + "type": "validation_error", + "code": "invalid_params" + } + } +} \ No newline at end of file diff --git a/dist/doc/payments/refunds/events.js b/dist/doc/payments/refunds/events.js index 101c6fd..fb7fd9c 100644 --- a/dist/doc/payments/refunds/events.js +++ b/dist/doc/payments/refunds/events.js @@ -17,6 +17,27 @@ const refund_failed = `{ } }` +const refund_needs_attention = `{ + "event": "refund.needs-attention", + "data": { + "status": "needs-attention", + "transaction_reference": "88bfa94509eb96aa9785641c26cc57cc", + "refund_reference": "TRF_7jn17u9vkqm91efk", + "amount": 5306, + "currency": "NGN", + "customer": { + "first_name": null, + "last_name": null, + "email": "customer@email.com" + }, + "integration": 123456, + "domain": "live", + "id": "123456", + "customer_note": "Refund for transaction 88bfa94509eb96aa9785641c26cc57cc", + "merchant_note": "Refund for transaction 88bfa94509eb96aa9785641c26cc57cc by paystack@email.com" + } +}` + const refund_pending = `{ "event": "refund.pending", "data": { @@ -74,4 +95,4 @@ const refund_processing = `{ } }` -export {refund_failed, refund_pending, refund_processed, refund_processing} \ No newline at end of file +export {refund_failed, refund_needs_attention, refund_pending, refund_processed, refund_processing} \ No newline at end of file diff --git a/dist/doc/payments/refunds/retry-refund.js b/dist/doc/payments/refunds/retry-refund.js new file mode 100644 index 0000000..f1000c0 --- /dev/null +++ b/dist/doc/payments/refunds/retry-refund.js @@ -0,0 +1,116 @@ +const sh = `#!/bin/sh +url="https://api.paystack.co/refundretry_with_customer_details/{id}" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "refund_account_details": { + "currency": "NGN", + "account_number": "1234567890", + "bank_id": "9" + } +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST` + +const js = `const https = require('https') + +const params = JSON.stringify({ + "refund_account_details": { + "currency": "NGN", + "account_number": "1234567890", + "bank_id": "9" + } +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/refund/retry_with_customer_details/{id}', + 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 = ` 1641, + "refund_account_details" => [ + "currency" => "NGN", + "account_number" => "1234567890", + "bank_id" => "9" + ] +]; + +$fields_string = http_build_query($fields); + +//open connection +$ch = curl_init(); + +//set the url, number of POST vars, POST data +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", + "Cache-Control: no-cache", +)); + +//So that curl_exec returns the contents of the cURL; rather than echoing it +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + +//execute post +$result = curl_exec($ch); +echo $result;` + +const json = `{ + "status": true, + "message": "Refund retried and has been queued for processing", + "data": { + "integration": 123456, + "transaction": 3298598423, + "dispute": null, + "settlement": null, + "id": 1234567, + "domain": "live", + "currency": "NGN", + "amount": 20000, + "status": "processing", + "refunded_at": null, + "expected_at": "2025-10-13T16:02:18.000Z", + "channel": "isw_3ds", + "refunded_by": "paystack@email.com", + "customer_note": "Refund for transaction T708775813895475", + "merchant_note": "Refund for transaction T708775813895475 by paystack@email.com", + "deducted_amount": 20000, + "fully_deducted": true, + "bank_reference": null, + "reason": "PROCESSING", + "customer": null, + "initiated_by": "paystack@email.com", + "reversed_at": null, + "session_id": null + } +}` + +export {sh, js, php, json} \ No newline at end of file diff --git a/src/api/refunds/retry/config.yml b/src/api/refunds/retry/config.yml new file mode 100644 index 0000000..e49a41b --- /dev/null +++ b/src/api/refunds/retry/config.yml @@ -0,0 +1,4 @@ +languages: + - sh + - js + - php \ No newline at end of file diff --git a/src/api/refunds/retry/index.js b/src/api/refunds/retry/index.js new file mode 100644 index 0000000..20e6dab --- /dev/null +++ b/src/api/refunds/retry/index.js @@ -0,0 +1,37 @@ +const https = require('https') + +const params = JSON.stringify({ + "refund_account_details": { + "currency": "NGN", + "account_number": "1234567890", + "bank_id": "9" + } +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/refund/retry_with_customer_details/{id}', + 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/refunds/retry/index.php b/src/api/refunds/retry/index.php new file mode 100644 index 0000000..41c3da8 --- /dev/null +++ b/src/api/refunds/retry/index.php @@ -0,0 +1,32 @@ + 1641, + "refund_account_details" => [ + "currency" => "NGN", + "account_number" => "1234567890", + "bank_id" => "9" + ] +]; + +$fields_string = http_build_query($fields); + +//open connection +$ch = curl_init(); + +//set the url, number of POST vars, POST data +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", + "Cache-Control: no-cache", +)); + +//So that curl_exec returns the contents of the cURL; rather than echoing it +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + +//execute post +$result = curl_exec($ch); +echo $result; diff --git a/src/api/refunds/retry/index.sh b/src/api/refunds/retry/index.sh new file mode 100644 index 0000000..0a96669 --- /dev/null +++ b/src/api/refunds/retry/index.sh @@ -0,0 +1,13 @@ +#!/bin/sh +url="https://api.paystack.co/refundretry_with_customer_details/{id}" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "refund_account_details": { + "currency": "NGN", + "account_number": "1234567890", + "bank_id": "9" + } +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST \ No newline at end of file diff --git a/src/api/refunds/retry/response.json b/src/api/refunds/retry/response.json new file mode 100644 index 0000000..762a8e3 --- /dev/null +++ b/src/api/refunds/retry/response.json @@ -0,0 +1,46 @@ +{ + "200": { + "description": "200 Ok", + "data": { + "status": true, + "message": "Refund retried and has been queued for processing", + "data": { + "integration": 123456, + "transaction": 3298598423, + "dispute": null, + "settlement": null, + "id": 1234567, + "domain": "live", + "currency": "NGN", + "amount": 20000, + "status": "processing", + "refunded_at": null, + "expected_at": "2025-10-13T16:02:18.000Z", + "channel": "isw_3ds", + "refunded_by": "paystack@email.com", + "customer_note": "Refund for transaction T708775813895475", + "merchant_note": "Refund for transaction T708775813895475 by paystack@email.com", + "deducted_amount": 20000, + "fully_deducted": true, + "bank_reference": null, + "reason": "PROCESSING", + "customer": null, + "initiated_by": "paystack@email.com", + "reversed_at": null, + "session_id": null + } + } + }, + "422": { + "description": "422", + "data": { + "status": false, + "message": "Invalid Refund state, refund status should be \"needs-attention\"", + "meta": { + "nextStep": "Ensure that the value(s) you're passing are valid." + }, + "type": "validation_error", + "code": "invalid_params" + } + } +} \ No newline at end of file diff --git a/src/doc/payments/refunds/events/refund-needs-attention.json b/src/doc/payments/refunds/events/refund-needs-attention.json new file mode 100644 index 0000000..46615d8 --- /dev/null +++ b/src/doc/payments/refunds/events/refund-needs-attention.json @@ -0,0 +1,20 @@ +{ + "event": "refund.needs-attention", + "data": { + "status": "needs-attention", + "transaction_reference": "88bfa94509eb96aa9785641c26cc57cc", + "refund_reference": "TRF_7jn17u9vkqm91efk", + "amount": 5306, + "currency": "NGN", + "customer": { + "first_name": null, + "last_name": null, + "email": "customer@email.com" + }, + "integration": 123456, + "domain": "live", + "id": "123456", + "customer_note": "Refund for transaction 88bfa94509eb96aa9785641c26cc57cc", + "merchant_note": "Refund for transaction 88bfa94509eb96aa9785641c26cc57cc by paystack@email.com" + } +} \ No newline at end of file diff --git a/src/doc/payments/refunds/retry-refund/config.yml b/src/doc/payments/refunds/retry-refund/config.yml new file mode 100644 index 0000000..3509c90 --- /dev/null +++ b/src/doc/payments/refunds/retry-refund/config.yml @@ -0,0 +1,5 @@ +languages: + - sh + - js + - php + - json \ No newline at end of file diff --git a/src/doc/payments/refunds/retry-refund/index.js b/src/doc/payments/refunds/retry-refund/index.js new file mode 100644 index 0000000..20e6dab --- /dev/null +++ b/src/doc/payments/refunds/retry-refund/index.js @@ -0,0 +1,37 @@ +const https = require('https') + +const params = JSON.stringify({ + "refund_account_details": { + "currency": "NGN", + "account_number": "1234567890", + "bank_id": "9" + } +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/refund/retry_with_customer_details/{id}', + 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/doc/payments/refunds/retry-refund/index.json b/src/doc/payments/refunds/retry-refund/index.json new file mode 100644 index 0000000..d38b92a --- /dev/null +++ b/src/doc/payments/refunds/retry-refund/index.json @@ -0,0 +1,29 @@ +{ + "status": true, + "message": "Refund retried and has been queued for processing", + "data": { + "integration": 123456, + "transaction": 3298598423, + "dispute": null, + "settlement": null, + "id": 1234567, + "domain": "live", + "currency": "NGN", + "amount": 20000, + "status": "processing", + "refunded_at": null, + "expected_at": "2025-10-13T16:02:18.000Z", + "channel": "isw_3ds", + "refunded_by": "paystack@email.com", + "customer_note": "Refund for transaction T708775813895475", + "merchant_note": "Refund for transaction T708775813895475 by paystack@email.com", + "deducted_amount": 20000, + "fully_deducted": true, + "bank_reference": null, + "reason": "PROCESSING", + "customer": null, + "initiated_by": "paystack@email.com", + "reversed_at": null, + "session_id": null + } +} \ No newline at end of file diff --git a/src/doc/payments/refunds/retry-refund/index.php b/src/doc/payments/refunds/retry-refund/index.php new file mode 100644 index 0000000..25c19b9 --- /dev/null +++ b/src/doc/payments/refunds/retry-refund/index.php @@ -0,0 +1,32 @@ + 1641, + "refund_account_details" => [ + "currency" => "NGN", + "account_number" => "1234567890", + "bank_id" => "9" + ] +]; + +$fields_string = http_build_query($fields); + +//open connection +$ch = curl_init(); + +//set the url, number of POST vars, POST data +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", + "Cache-Control: no-cache", +)); + +//So that curl_exec returns the contents of the cURL; rather than echoing it +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + +//execute post +$result = curl_exec($ch); +echo $result; \ No newline at end of file diff --git a/src/doc/payments/refunds/retry-refund/index.sh b/src/doc/payments/refunds/retry-refund/index.sh new file mode 100644 index 0000000..0a96669 --- /dev/null +++ b/src/doc/payments/refunds/retry-refund/index.sh @@ -0,0 +1,13 @@ +#!/bin/sh +url="https://api.paystack.co/refundretry_with_customer_details/{id}" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "refund_account_details": { + "currency": "NGN", + "account_number": "1234567890", + "bank_id": "9" + } +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST \ No newline at end of file