-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrequests.js
More file actions
62 lines (50 loc) · 1.27 KB
/
requests.js
File metadata and controls
62 lines (50 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const sh = `#!/bin/sh
url="https://api.paystack.co/capitec-pay/requery/{ref}"
authorization="Authorization: Bearer pk_domain_xxxxx"
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 pk_domain_xxxxx'
}
}
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 pk_domain_xxxxx",
"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}