diff --git a/dist/doc/payments/payment-methods/pesalink.js b/dist/doc/payments/payment-methods/pesalink.js new file mode 100644 index 0000000..c328653 --- /dev/null +++ b/dist/doc/payments/payment-methods/pesalink.js @@ -0,0 +1,110 @@ +const sh = `#!/bin/sh + +url="https://api.paystack.co/charge" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "email": "user@example.com", + "amount": "10000", + "bank_transfer": { + "account_expires_at": "2025-04-24T16:40:57.954Z" + } +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST` + +const js = `const https = require('https') + +const params = JSON.stringify({ + "email": "user@example.com", + "amount": "10000", + "bank_transfer": { + "account_expires_at": "2025-04-24T16:40:57.954Z" + } +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/charge', + 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 = ` "https://api.paystack.co/charge", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => [ + "email" => "user@example.com", + "amount" => "10000", + "bank_transfer" => [ + "account_expires_at" => "2025-04-24T16:40:57.954Z" + ] + ], + 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; + } +?>` + +const json = `{ + "status": true, + "message": "Charge attempted", + "data": { + "reference": "kcvu0t3kzs", + "status": "pending_bank_transfer", + "display_text": "Please make a transfer to the account specified", + "account_name": "Paystack Payments Kenya Limited", + "account_number": "1234567891", + "bank": { + "slug": "dtbk-bank", + "name": "Diamond Trust Bank Kenya Ltd", + "id": 225 + }, + "account_expires_at": "2025-04-24T16:55:57.954Z", + "amount": 10000, + "transaction_reference": "1234567" + } +}` + +export {sh, js, php, json} \ No newline at end of file diff --git a/src/doc/payments/payment-methods/pesalink/config.yml b/src/doc/payments/payment-methods/pesalink/config.yml new file mode 100644 index 0000000..3509c90 --- /dev/null +++ b/src/doc/payments/payment-methods/pesalink/config.yml @@ -0,0 +1,5 @@ +languages: + - sh + - js + - php + - json \ No newline at end of file diff --git a/src/doc/payments/payment-methods/pesalink/index.js b/src/doc/payments/payment-methods/pesalink/index.js new file mode 100644 index 0000000..e2a79e5 --- /dev/null +++ b/src/doc/payments/payment-methods/pesalink/index.js @@ -0,0 +1,37 @@ +const https = require('https') + +const params = JSON.stringify({ + "email": "user@example.com", + "amount": "10000", + "bank_transfer": { + "account_expires_at": "2025-04-24T16:40:57.954Z" + } +}) + +const options = { + hostname: 'api.paystack.co', + port: 443, + path: '/charge', + 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/payment-methods/pesalink/index.json b/src/doc/payments/payment-methods/pesalink/index.json new file mode 100644 index 0000000..7a5c1d2 --- /dev/null +++ b/src/doc/payments/payment-methods/pesalink/index.json @@ -0,0 +1,19 @@ +{ + "status": true, + "message": "Charge attempted", + "data": { + "reference": "kcvu0t3kzs", + "status": "pending_bank_transfer", + "display_text": "Please make a transfer to the account specified", + "account_name": "Paystack Payments Kenya Limited", + "account_number": "1234567891", + "bank": { + "slug": "dtbk-bank", + "name": "Diamond Trust Bank Kenya Ltd", + "id": 225 + }, + "account_expires_at": "2025-04-24T16:55:57.954Z", + "amount": 10000, + "transaction_reference": "1234567" + } +} \ No newline at end of file diff --git a/src/doc/payments/payment-methods/pesalink/index.php b/src/doc/payments/payment-methods/pesalink/index.php new file mode 100644 index 0000000..1051b70 --- /dev/null +++ b/src/doc/payments/payment-methods/pesalink/index.php @@ -0,0 +1,35 @@ + "https://api.paystack.co/charge", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => [ + "email" => "user@example.com", + "amount" => "10000", + "bank_transfer" => [ + "account_expires_at" => "2025-04-24T16:40:57.954Z" + ] + ], + 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/doc/payments/payment-methods/pesalink/index.sh b/src/doc/payments/payment-methods/pesalink/index.sh new file mode 100644 index 0000000..8e1c24a --- /dev/null +++ b/src/doc/payments/payment-methods/pesalink/index.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +url="https://api.paystack.co/charge" +authorization="Authorization: Bearer YOUR_SECRET_KEY" +content_type="Content-Type: application/json" +data='{ + "email": "user@example.com", + "amount": "10000", + "bank_transfer": { + "account_expires_at": "2025-04-24T16:40:57.954Z" + } +}' + +curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST \ No newline at end of file