Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions dist/doc/payments/payment-methods/pesalink.js
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}
5 changes: 5 additions & 0 deletions src/doc/payments/payment-methods/pesalink/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
languages:
- sh
- js
- php
- json
37 changes: 37 additions & 0 deletions src/doc/payments/payment-methods/pesalink/index.js
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()
19 changes: 19 additions & 0 deletions src/doc/payments/payment-methods/pesalink/index.json
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",
Copy link
Member

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

"name": "Diamond Trust Bank Kenya Ltd",
"id": 225
},
"account_expires_at": "2025-04-24T16:55:57.954Z",
"amount": 10000,
"transaction_reference": "1234567"
}
}
35 changes: 35 additions & 0 deletions src/doc/payments/payment-methods/pesalink/index.php
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;
}
?>
14 changes: 14 additions & 0 deletions src/doc/payments/payment-methods/pesalink/index.sh
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