-
Notifications
You must be signed in to change notification settings - Fork 3
Add pay with Pesalink #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
2fa55c8
f04bf5a
9560f2e
c4fe730
817fb06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| 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 = `<?php | ||
| $curl = curl_init(); | ||
|
|
||
| curl_setopt_array($curl, array( | ||
| CURLOPT_URL => "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": "1260257501", | ||
| "bank": { | ||
| "slug": "diamond-trust-bank-ltd-ke", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a discrepancy between the generated and src file. The slug here seems to be spelled out as opposed to what was in the |
||
| "name": "Diamond Trust Bank Kenya Ltd", | ||
| "id": 225 | ||
| }, | ||
| "account_expires_at": "2025-04-24T16:55:57.954Z" | ||
| } | ||
| }` | ||
|
|
||
| export {sh, js, php, json} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| languages: | ||
| - sh | ||
| - js | ||
| - php | ||
| - json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Point in case to the first comment |
||
| "name": "Diamond Trust Bank Kenya Ltd", | ||
| "id": 225 | ||
| }, | ||
| "account_expires_at": "2025-04-24T16:55:57.954Z", | ||
| "amount": 10000, | ||
| "transaction_reference": "1234567" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <?php | ||
| $curl = curl_init(); | ||
|
|
||
| curl_setopt_array($curl, array( | ||
| CURLOPT_URL => "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; | ||
| } | ||
| ?> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The account number is also different