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
62 changes: 62 additions & 0 deletions dist/api/capitec-pay/requery/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/capitec-pay/requery/{ref}"
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: '/capitec-pay/requery/{ref}',
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/capitec-pay/requery/{ref}",
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}
59 changes: 59 additions & 0 deletions dist/api/capitec-pay/requery/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"200": {
"description": "200 Ok",
"data": {
"status": true,
"type": "success",
"code": "ok",
"data": {
"status": "success"
},
"message": "Charge successful"
}
},
"200_pending": {
"description": "200 Pending",
"data": {
"status": true,
"type": "success",
"code": "ok",
"data": {
"status": "pending"
},
"message": "Charge pending"
}
},
"200_failed": {
"description": "200 Failed",
"data": {
"status": true,
"type": "success",
"code": "ok",
"data": {
"status": "failed"
},
"message": "Account is de-activated, please contact Capitec for help"
}
},
"400": {
"description": "400 Bad Request",
"data": {
"status": false,
"message": "Transaction not found",
"meta": {
"nextStep": "Ensure that you're passing the reference of a transaction that exists on this integration"
},
"type": "validation_error",
"code": "transaction_not_found"
}
},
"500": {
"description": "500 Server Error",
"data": {
"status": false,
"code": "unknown",
"type": "api_error",
"message": "An error occurred"
}
}
}
118 changes: 118 additions & 0 deletions dist/doc/payments/payment-methods/capitec-pay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
const sh = `curl https://api.paystack.co/charge
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-d '{ "amount": 1000,
"email": "drew.john@email.com",
"currency": "ZAR",
"capitec_pay": {
"identifier_key" : "CELLPHONE",
"identifier_value" : "0812345678"
}
}'
-X POST`

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

const params = JSON.stringify({
"email": "drew.john@mail.com",
"amount": 1000,
"currency": "ZAR",
"capitec_pay": {
"identifier_key": "CELLPHONE",
"identifier_value": "0812345678"
}
})

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 => [
"amount" => 1000,
"email" => "drew.john@email.com",
"currency" => "ZAR",
"capitec_pay" => [
"identifier_key" => "CELLPHONE",
"identifier_value" => "0812345678"
]
],
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer SECRET_KEY",
"Content-Type: application/json" ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>`

const json = `{
"type": "success",
"code": "ok",
"data": {
"status": "success",
"timeToLive": 120,
"expiryDate": "2026-02-17T11:29:37.000Z",
"transaction": {
"id": 5805764100,
"reference": "nvh8o4pwtivwkx4",
"domain": "live",
"amount": 1000,
"currency": "ZAR",
"metadata": "",
"createdAt": "2026-02-17T11:27:36.000Z",
"customer": {
"id": 180101459,
"first_name": "Drew",
"last_name": "John",
"email": "drew.john@email.com",
"customer_code": "CUS_xy1ofyzvnhagniv",
"phone": "",
"metadata": null,
"risk_action": "default",
"international_format_phone": null
}
}
},
"message": "Charge pending"
}`

export {sh, js, php, json}
4 changes: 4 additions & 0 deletions src/api/capitec-pay/requery/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
languages:
- sh
- js
- php
25 changes: 25 additions & 0 deletions src/api/capitec-pay/requery/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const https = require('https')

const options = {
hostname: 'api.paystack.co',
port: 443,
path: '/capitec-pay/requery/{ref}',
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)
})
28 changes: 28 additions & 0 deletions src/api/capitec-pay/requery/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.paystack.co/capitec-pay/requery/{ref}",
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;
}
?>
5 changes: 5 additions & 0 deletions src/api/capitec-pay/requery/index.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
url="https://api.paystack.co/capitec-pay/requery/{ref}"
authorization="Authorization: Bearer YOUR_SECRET_KEY"

curl "$url" -H "$authorization" -X GET
59 changes: 59 additions & 0 deletions src/api/capitec-pay/requery/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"200": {
"description": "200 Ok",
"data": {
"status": true,
"type": "success",
"code": "ok",
"data": {
"status": "success"
},
"message": "Charge successful"
}
},
"200_pending": {
"description": "200 Pending",
"data": {
"status": true,
"type": "success",
"code": "ok",
"data": {
"status": "pending"
},
"message": "Charge pending"
}
},
"200_failed": {
"description": "200 Failed",
"data": {
"status": true,
"type": "success",
"code": "ok",
"data": {
"status": "failed"
},
"message": "Account is de-activated, please contact Capitec for help"
}
},
"400": {
"description": "400 Bad Request",
"data": {
"status": false,
"message": "Transaction not found",
"meta": {
"nextStep": "Ensure that you're passing the reference of a transaction that exists on this integration"
},
"type": "validation_error",
"code": "transaction_not_found"
}
},
"500": {
"description": "500 Server Error",
"data": {
"status": false,
"code": "unknown",
"type": "api_error",
"message": "An error occurred"
}
}
}
5 changes: 5 additions & 0 deletions src/doc/payments/payment-methods/capitec-pay/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
languages:
- sh
- js
- php
- json
Loading