-
Notifications
You must be signed in to change notification settings - Fork 2
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2fa55c8
add pesalink code snippets
Andrew-Paystack f04bf5a
generate code snippets
Andrew-Paystack 9560f2e
Merge branch 'main' into fix/update-preauth
Andrew-Paystack c4fe730
update response payload
Andrew-Paystack 817fb06
build response payload
Andrew-Paystack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 = `<?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": "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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| languages: | ||
| - sh | ||
| - js | ||
| - php | ||
| - json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| "name": "Diamond Trust Bank Kenya Ltd", | ||
| "id": 225 | ||
| }, | ||
| "account_expires_at": "2025-04-24T16:55:57.954Z", | ||
| "amount": 10000, | ||
| "transaction_reference": "1234567" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Point in case to the first comment