File tree Expand file tree Collapse file tree
dist/api/preauthorization Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,4 +43,35 @@ const req = https.request(options, res => {
4343req.write(params)
4444req.end()`
4545
46- export { sh , js }
46+ const php = `<?php
47+ $url = "https://api.paystack.co/preauthorization/capture";
48+
49+ $fields = [
50+ 'reference' => '123-abc'
51+ 'currency' => 'ZAR'
52+ 'amount' => '10000'
53+ ];
54+
55+ $fields_string = http_build_query($fields);
56+
57+ //open connection
58+ $ch = curl_init();
59+
60+ //set the url, number of POST vars, POST data
61+ curl_setopt($ch,CURLOPT_URL, $url);
62+ curl_setopt($ch,CURLOPT_POST, true);
63+ curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
64+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
65+ "Authorization: Bearer SECRET_KEY",
66+ "Cache-Control: no-cache",
67+ ));
68+
69+ //So that curl_exec returns the contents of the cURL; rather than echoing it
70+ curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
71+
72+ //execute post
73+ $result = curl_exec($ch);
74+ echo $result;
75+ ?>`
76+
77+ export { sh , js , php }
Original file line number Diff line number Diff line change @@ -43,4 +43,35 @@ const req = https.request(options, res => {
4343req.write(params)
4444req.end()`
4545
46- export { sh , js }
46+ const php = `<?php
47+ $url = "https://api.paystack.co/preauthorization/initialize";
48+
49+ $fields = [
50+ 'reference' => '123-abc'
51+ 'currency' => 'ZAR'
52+ 'amount' => '10000'
53+ ];
54+
55+ $fields_string = http_build_query($fields);
56+
57+ //open connection
58+ $ch = curl_init();
59+
60+ //set the url, number of POST vars, POST data
61+ curl_setopt($ch,CURLOPT_URL, $url);
62+ curl_setopt($ch,CURLOPT_POST, true);
63+ curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
64+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
65+ "Authorization: Bearer SECRET_KEY",
66+ "Cache-Control: no-cache",
67+ ));
68+
69+ //So that curl_exec returns the contents of the cURL; rather than echoing it
70+ curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
71+
72+ //execute post
73+ $result = curl_exec($ch);
74+ echo $result;
75+ ?>`
76+
77+ export { sh , js , php }
Original file line number Diff line number Diff line change @@ -40,4 +40,33 @@ const req = https.request(options, res => {
4040req.write(params)
4141req.end()`
4242
43- export { sh , js }
43+ const php = `<?php
44+ $url = "https://api.paystack.co/preauthorization/release";
45+
46+ $fields = [
47+ 'reference' => '123-abc'
48+ ];
49+
50+ $fields_string = http_build_query($fields);
51+
52+ //open connection
53+ $ch = curl_init();
54+
55+ //set the url, number of POST vars, POST data
56+ curl_setopt($ch,CURLOPT_URL, $url);
57+ curl_setopt($ch,CURLOPT_POST, true);
58+ curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
59+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
60+ "Authorization: Bearer SECRET_KEY",
61+ "Cache-Control: no-cache",
62+ ));
63+
64+ //So that curl_exec returns the contents of the cURL; rather than echoing it
65+ curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
66+
67+ //execute post
68+ $result = curl_exec($ch);
69+ echo $result;
70+ ?>`
71+
72+ export { sh , js , php }
Original file line number Diff line number Diff line change @@ -46,4 +46,36 @@ const req = https.request(options, res => {
4646req.write(params)
4747req.end()`
4848
49- export { sh , js }
49+ const php = `<?php
50+ $url = "https://api.paystack.co/preauthorization/reserve_authorization";
51+
52+ $fields = [
53+ 'email' => 'test@paystack.com',
54+ 'currency' => 'ZAR',
55+ 'amount' => 1000,
56+ 'authorization_code' => 'AUTH_dalhwqi5vw',
57+ ];
58+
59+ $fields_string = http_build_query($fields);
60+
61+ //open connection
62+ $ch = curl_init();
63+
64+ //set the url, number of POST vars, POST data
65+ curl_setopt($ch,CURLOPT_URL, $url);
66+ curl_setopt($ch,CURLOPT_POST, true);
67+ curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
68+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
69+ "Authorization: Bearer SECRET_KEY",
70+ "Cache-Control: no-cache",
71+ ));
72+
73+ //So that curl_exec returns the contents of the cURL; rather than echoing it
74+ curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
75+
76+ //execute post
77+ $result = curl_exec($ch);
78+ echo $result;
79+ ?>`
80+
81+ export { sh , js , php }
Original file line number Diff line number Diff line change @@ -31,4 +31,33 @@ const req = https.request(options, res => {
3131})
3232req.end()`
3333
34- export { sh , js }
34+ const php = `<?php
35+ $curl = curl_init();
36+
37+ curl_setopt_array($curl, array(
38+ CURLOPT_URL => "https://api.paystack.co/preauthorization/verify/:reference",
39+ CURLOPT_RETURNTRANSFER => true,
40+ CURLOPT_ENCODING => "",
41+ CURLOPT_MAXREDIRS => 10,
42+ CURLOPT_TIMEOUT => 30,
43+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
44+ CURLOPT_CUSTOMREQUEST => "GET",
45+ CURLOPT_HTTPHEADER => array(
46+ "Authorization: Bearer SECRET_KEY",
47+ "Cache-Control: no-cache",
48+ ),
49+ ));
50+
51+ $response = curl_exec($curl);
52+ $err = curl_error($curl);
53+
54+ curl_close($curl);
55+
56+ if ($err) {
57+ echo "cURL Error #:" . $err;
58+ } else {
59+ echo $response;
60+ }
61+ ?>`
62+
63+ export { sh , js , php }
Original file line number Diff line number Diff line change 11languages :
22 - sh
3- - js
3+ - js
4+ - php
Original file line number Diff line number Diff line change 11languages :
22 - sh
3- - js
3+ - js
4+ - php
Original file line number Diff line number Diff line change 11languages :
22 - sh
3- - js
3+ - js
4+ - php
Original file line number Diff line number Diff line change 11languages :
22 - sh
3- - js
3+ - js
4+ - php
Original file line number Diff line number Diff line change 11languages :
22 - sh
3- - js
3+ - js
4+ - php
You can’t perform that action at this time.
0 commit comments