1+ const js = `const https = require('https')
2+
3+ const options = {
4+ hostname: 'api.paystack.co',
5+ port: 443,
6+ path: '/transaction?use_cursor=true&perPage=50',
7+ method: 'GET',
8+ headers: {
9+ Authorization: 'Bearer YOUR_SECRET_KEY'
10+ }
11+ }
12+
13+ https.request(options, res => {
14+ let data = ''
15+
16+ res.on('data', (chunk) => {
17+ data += chunk
18+ });
19+
20+ res.on('end', () => {
21+ console.log(JSON.parse(data))
22+ })
23+ }).on('error', error => {
24+ console.error(error)
25+ })`
26+
27+ const php = `<?php
28+ $curl = curl_init();
29+
30+ curl_setopt_array($curl, array(
31+ CURLOPT_URL => "https://api.paystack.co/transaction?use_cursor=true&perPage=50",
32+ CURLOPT_RETURNTRANSFER => true,
33+ CURLOPT_ENCODING => "",
34+ CURLOPT_MAXREDIRS => 10,
35+ CURLOPT_TIMEOUT => 30,
36+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
37+ CURLOPT_CUSTOMREQUEST => "GET",
38+ CURLOPT_HTTPHEADER => array(
39+ "Authorization: Bearer YOUR_SECRET_KEY",
40+ "Cache-Control: no-cache",
41+ ),
42+ ));
43+
44+ $response = curl_exec($curl);
45+ $err = curl_error($curl);
46+
47+ curl_close($curl);
48+
49+ if ($err) {
50+ echo "cURL Error #:" . $err;
51+ } else {
52+ echo $response;
53+ }
54+ ?>`
55+
56+ const sh = `#!/bin/sh
57+ url="https://api.paystack.co/transaction?use_cursor=true&perPage=50"
58+ authorization="Authorization: Bearer YOUR_SECRET_KEY"
59+
60+ curl "$url" -H "$authorization" -X GET`
61+
62+ export { js , php , sh }
0 commit comments