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
73 changes: 73 additions & 0 deletions dist/api/customers/direct-debit-activation-charge/requests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
const sh = `#!/bin/sh
curl https://api.paystack.co/customer/{id}/directdebit-activation-charge
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-d '{
"authorization_id" : 1069309917
}'
-X PUT`

const js = `const https = require('https')

const params = JSON.stringify({
"authorization_id" : 1069309917
})

const options = {
hostname: 'api.paystack.co',
port: 443,
path: '/customer/{id}/directdebit-activation-charge',
method: 'PUT',
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
$url = "https://api.paystack.co/customer/{id}/directdebit-activation-charge";

$fields = [
'authorization_id' => 1069309917
];

$fields_string = http_build_query($fields);

//open connection
$ch = curl_init();

//set the url, PUT data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
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}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"200": {
"description": "200 Ok",
"data": {
"status": true,
"message": "Mandate is queued for retry"
}
}
}
62 changes: 62 additions & 0 deletions dist/api/customers/fetch-mandate-authorization/requests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const sh = `#!/bin/sh
url="https://api.paystack.co/customer/{id}/directdebit-mandate-authorizations"
authorization="Authorization: Bearer YOUR_SECRET_KEY"

curl "$url" -H "$authorization" -X GET`

const js = `const https = require('https')

const options = {
hostname: 'api.paystack.co',
port: 443,
path: '/customer/{id}/directdebit-mandate-authorizations',
method: 'GET',
headers: {
Authorization: 'Bearer SECRET_KEY'
}
}

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)
})`

const php = `<?php
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.paystack.co//customer/{id}/directdebit-mandate-authorizations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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;
}
?>`

export {sh, js, php}
36 changes: 36 additions & 0 deletions dist/api/customers/fetch-mandate-authorization/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"200": {
"description": "200 Ok",
"data": {
"status": true,
"message": "Mandate authorizations retrieved successfully",
"data": [
{
"id": 164098,
"status": "active",
"mandate_id": 512003,
"authorization_id": 110049014,
"authorization_code": "AUTH_8Lol0pNt14",
"integration_id": 463433,
"account_number": "0123456789",
"bank_code": "032",
"bank_name": null,
"customer": {
"id": 43975700,
"customer_code": "CUS_2eusy8uwe34s23fy",
"email": "[email protected]",
"first_name": "Smith",
"last_name": "Bel"
},
"authorized_at": "2024-09-27T10:57:53.824Z"
}
],
"meta": {
"per_page": 50,
"next": null,
"count": 1,
"total": 1
}
}
}
}
98 changes: 98 additions & 0 deletions dist/api/customers/initialize-direct-debit/requests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
const sh = `#!/bin/sh
url="https://api.paystack.co/customer/{id}/initialize-direct-debit"
authorization="Authorization: Bearer YOUR_SECRET_KEY"
content_type="Content-Type: application/json"
data='{
"account": {
"number": "0123456789",
"bank_code": "058"
},
"address": {
"street": "Some Where",
"city": "Ikeja",
"state": "Lagos"
}
}'

curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST`

const js = `const https = require('https')

const params = JSON.stringify({
"account": {
"number": "0123456789",
"bank_code": "058"
},
"address": {
"street": "Some Where",
"city": "Ikeja",
"state": "Lagos"
}
})

const options = {
hostname: 'api.paystack.co',
port: 443,
path: '/customer/{id}/initialize-direct-debit',
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
$url = "https://api.paystack.co/customer/{id}/initialize-direct-debit";

$fields = [
'account' => [
'number' => '0123456789',
'bank_code' => '058'
],
'address' => [
'street' => 'Some Where',
'city' => 'Ikeja',
'state' => 'Lagos'
]
];

$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}
14 changes: 14 additions & 0 deletions dist/api/customers/initialize-direct-debit/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"200": {
"description": "200 Ok",
"data": {
"status": true,
"message": "Authorization initialized",
"data": {
"redirect_url": "https://link.paystack.com/ll6b0szngj1f27k",
"access_code": "ll6b0szngj1f27k",
"reference": "1er945lpy4txyki"
}
}
}
}
73 changes: 73 additions & 0 deletions dist/api/direct-debit/activation-charge/requests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
const sh = `#!/bin/sh
curl https://api.paystack.co/directdebit/activation-charge
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-d '{
"customer_ids": [28958104, 983697220]
}'
-X PUT`

const js = `const https = require('https')

const params = JSON.stringify({
"customer_ids": [28958104, 983697220]
})

const options = {
hostname: 'api.paystack.co',
port: 443,
path: '/directdebit/activation-charge',
method: 'PUT',
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
$url = "https://api.paystack.co/directdebit/activation-charge";

$fields = [
'customer_ids' => [28958104, 983697220]
];

$fields_string = http_build_query($fields);

//open connection
$ch = curl_init();

//set the url, PUT data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
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}
9 changes: 9 additions & 0 deletions dist/api/direct-debit/activation-charge/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"200": {
"description": "200 Ok",
"data": {
"status": true,
"message": "Mandate is queued for retry"
}
}
}
Loading