File tree Expand file tree Collapse file tree 12 files changed +162
-0
lines changed
Expand file tree Collapse file tree 12 files changed +162
-0
lines changed Original file line number Diff line number Diff line change 1+ type : standalone
2+ languages :
3+ - json
Original file line number Diff line number Diff line change 1+ {
2+ "meta" : {
3+ "next" : " dW5kZWZpbmVkOjQwOTczNTgxNTg=" ,
4+ "previous" : " null" ,
5+ "perPage" : 49
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ type : standalone
2+ languages :
3+ - js
4+ - php
5+ - sh
Original file line number Diff line number Diff line change 1+ const https = require ( 'https' )
2+
3+ const use_cursor = true ;
4+ const perPage = 50 ;
5+ const options = {
6+ hostname : 'api.paystack.co' ,
7+ port : 443 ,
8+ path : `/transaction?use_cursor=${ use_cursor } &perPage=${ perPage } ` ,
9+ method : 'GET' ,
10+ headers : {
11+ Authorization : 'Bearer YOUR_SECRET_KEY'
12+ }
13+ }
14+
15+ https . request ( options , res => {
16+ let data = ''
17+
18+ res . on ( 'data' , ( chunk ) => {
19+ data += chunk
20+ } ) ;
21+
22+ res . on ( 'end' , ( ) => {
23+ console . log ( JSON . parse ( data ) )
24+ } )
25+ } ) . on ( 'error' , error => {
26+ console . error ( error )
27+ } )
Original file line number Diff line number Diff line change 1+ <?php
2+ $ use_cursor = true ;
3+ $ perPage = 50 ;
4+ $ curl = curl_init ();
5+
6+ curl_setopt_array ($ curl , array (
7+ CURLOPT_URL => "https://api.paystack.co/transaction?use_cursor= $ use_cursor&perPage= $ perPage " ,
8+ CURLOPT_RETURNTRANSFER => true ,
9+ CURLOPT_ENCODING => "" ,
10+ CURLOPT_MAXREDIRS => 10 ,
11+ CURLOPT_TIMEOUT => 30 ,
12+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
13+ CURLOPT_CUSTOMREQUEST => "GET " ,
14+ CURLOPT_HTTPHEADER => array (
15+ "Authorization: Bearer YOUR_SECRET_KEY " ,
16+ "Cache-Control: no-cache " ,
17+ ),
18+ ));
19+
20+ $ response = curl_exec ($ curl );
21+ $ err = curl_error ($ curl );
22+
23+ curl_close ($ curl );
24+
25+ if ($ err ) {
26+ echo "cURL Error #: " . $ err ;
27+ } else {
28+ echo $ response ;
29+ }
30+ ?>
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ use_cursor=" true"
3+ perPage=" 50"
4+ url=" https://api.paystack.co/transaction?use_cursor=$use_cursor &perPage=$perPage "
5+ authorization=" Authorization: Bearer YOUR_SECRET_KEY"
6+
7+ curl " $url " -H " $authorization " -X GET
Original file line number Diff line number Diff line change 1+ # TODO: Work on handling multiple non-response JSON
2+ type : standalone
3+ languages :
4+ - json
Original file line number Diff line number Diff line change 1+ {
2+ "meta" : {
3+ "total" : 7316 ,
4+ "total_volume" : 397800 ,
5+ "skipped" : 0 ,
6+ "perPage" : 50 ,
7+ "page" : 1 ,
8+ "pageCount" : 147
9+ }
10+ }
Original file line number Diff line number Diff line change 1+ type : standalone
2+ languages :
3+ - js
4+ - php
5+ - sh
Original file line number Diff line number Diff line change 1+ const https = require ( 'https' )
2+
3+ const page = 1 ;
4+ const perPage = 50 ;
5+ const options = {
6+ hostname : 'api.paystack.co' ,
7+ port : 443 ,
8+ path : `/transaction?page=${ page } &perPage=${ perPage } ` ,
9+ method : 'GET' ,
10+ headers : {
11+ Authorization : 'Bearer SECRET_KEY'
12+ }
13+ }
14+
15+ https . request ( options , res => {
16+ let data = ''
17+
18+ res . on ( 'data' , ( chunk ) => {
19+ data += chunk
20+ } ) ;
21+
22+ res . on ( 'end' , ( ) => {
23+ console . log ( JSON . parse ( data ) )
24+ } )
25+ } ) . on ( 'error' , error => {
26+ console . error ( error )
27+ } )
You can’t perform that action at this time.
0 commit comments