1+ const sh = `curl https://api.paystack.co/charge
2+ -H "Authorization: Bearer YOUR_SECRET_KEY"
3+ -H "Content-Type: application/json"
4+ -d '{ "amount": 1000,
5+ "email": "drew.john@email.com",
6+ "currency": "ZAR",
7+ "capitec_pay": {
8+ "identifier_key" : "CELLPHONE",
9+ "identifier_value" : "0812345678"
10+ }
11+ }'
12+ -X POST`
13+
14+ const js = `const https = require('https')
15+
16+ const params = JSON.stringify({
17+ "email": "drew.john@mail.com",
18+ "amount": 1000,
19+ "currency": "ZAR",
20+ "capitec_pay": {
21+ "identifier_key": "CELLPHONE",
22+ "identifier_value": "0812345678"
23+ }
24+ })
25+
26+ const options = {
27+ hostname: 'api.paystack.co',
28+ port: 443,
29+ path: '/charge',
30+ method: 'POST',
31+ headers: {
32+ Authorization: 'Bearer SECRET_KEY',
33+ 'Content-Type': 'application/json'
34+ }
35+ }
36+
37+ const req = https.request(options, res => {
38+ let data = ''
39+
40+ res.on('data', (chunk) => {
41+ data += chunk
42+ });
43+
44+ res.on('end', () => {
45+ console.log(JSON.parse(data))
46+ })
47+ }).on('error', error => {
48+ console.error(error)
49+ })
50+
51+ req.write(params)
52+ req.end()`
53+
54+ const php = `<?php
55+ $curl = curl_init();
56+ curl_setopt_array($curl, array(
57+ CURLOPT_URL => "https://api.paystack.co/charge",
58+ CURLOPT_RETURNTRANSFER => true,
59+ CURLOPT_ENCODING => "",
60+ CURLOPT_MAXREDIRS => 10,
61+ CURLOPT_TIMEOUT => 30,
62+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
63+ CURLOPT_CUSTOMREQUEST => "POST",
64+ CURLOPT_POSTFIELDS => [
65+ "amount" => 1000,
66+ "email" => "drew.john@email.com",
67+ "currency" => "ZAR",
68+ "capitec_pay" => [
69+ "identifier_key" => "CELLPHONE",
70+ "identifier_value" => "0812345678"
71+ ]
72+ ],
73+ CURLOPT_HTTPHEADER => array(
74+ "Authorization: Bearer SECRET_KEY",
75+ "Content-Type: application/json" ),
76+ ));
77+ $response = curl_exec($curl);
78+ $err = curl_error($curl);
79+ curl_close($curl);
80+ if ($err) {
81+ echo "cURL Error #:" . $err;
82+ } else {
83+ echo $response;
84+ }
85+ ?>`
86+
87+ const json = `{
88+ "type": "success",
89+ "code": "ok",
90+ "data": {
91+ "status": "success",
92+ "timeToLive": 120,
93+ "expiryDate": "2026-02-17T11:29:37.000Z",
94+ "transaction": {
95+ "id": 5805764100,
96+ "reference": "nvh8o4pwtivwkx4",
97+ "domain": "live",
98+ "amount": 1000,
99+ "currency": "ZAR",
100+ "metadata": "",
101+ "createdAt": "2026-02-17T11:27:36.000Z",
102+ "customer": {
103+ "id": 180101459,
104+ "first_name": "Drew",
105+ "last_name": "John",
106+ "email": "drew.john@email.com",
107+ "customer_code": "CUS_xy1ofyzvnhagniv",
108+ "phone": "",
109+ "metadata": null,
110+ "risk_action": "default",
111+ "international_format_phone": null
112+ }
113+ }
114+ },
115+ "message": "Charge pending"
116+ }`
117+
118+ export { sh , js , php , json }
0 commit comments