File tree Expand file tree Collapse file tree 5 files changed +108
-0
lines changed
src/doc/payments/payment-methods/pesalink Expand file tree Collapse file tree 5 files changed +108
-0
lines changed Original file line number Diff line number Diff line change 1+ languages :
2+ - sh
3+ - js
4+ - php
5+ - json
Original file line number Diff line number Diff line change 1+ const https = require ( 'https' )
2+
3+ const params = JSON . stringify ( {
4+ 5+ "amount" : "10000" ,
6+ "bank_transfer" : {
7+ "account_expires_at" : "2025-04-24T16:40:57.954Z"
8+ }
9+ } )
10+
11+ const options = {
12+ hostname : 'api.paystack.co' ,
13+ port : 443 ,
14+ path : '/charge' ,
15+ method : 'POST' ,
16+ headers : {
17+ Authorization : 'Bearer SECRET_KEY' ,
18+ 'Content-Type' : 'application/json'
19+ }
20+ }
21+
22+ const req = https . request ( options , res => {
23+ let data = ''
24+
25+ res . on ( 'data' , ( chunk ) => {
26+ data += chunk
27+ } ) ;
28+
29+ res . on ( 'end' , ( ) => {
30+ console . log ( JSON . parse ( data ) )
31+ } )
32+ } ) . on ( 'error' , error => {
33+ console . error ( error )
34+ } )
35+
36+ req . write ( params )
37+ req . end ( )
Original file line number Diff line number Diff line change 1+ {
2+ "status" : true ,
3+ "message" : " Charge attempted" ,
4+ "data" : {
5+ "reference" : " kcvu0t3kzs" ,
6+ "status" : " pending_bank_transfer" ,
7+ "display_text" : " Please make a transfer to the account specified" ,
8+ "account_name" : " Paystack Payments Kenya Limited" ,
9+ "account_number" : " 1260257501" ,
10+ "bank" : {
11+ "slug" : " diamond-trust-bank-ltd-ke" ,
12+ "name" : " Diamond Trust Bank Kenya Ltd" ,
13+ "id" : 225
14+ },
15+ "account_expires_at" : " 2025-04-24T16:55:57.954Z"
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ $ curl = curl_init ();
3+
4+ curl_setopt_array ($ curl , array (
5+ CURLOPT_URL => "https://api.paystack.co/charge " ,
6+ CURLOPT_RETURNTRANSFER => true ,
7+ CURLOPT_ENCODING => "" ,
8+ CURLOPT_MAXREDIRS => 10 ,
9+ CURLOPT_TIMEOUT => 30 ,
10+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
11+ CURLOPT_CUSTOMREQUEST => "POST " ,
12+ CURLOPT_POSTFIELDS => [
13+ 14+ "amount " => "10000 " ,
15+ "bank_transfer " => [
16+ "account_expires_at " => "2025-04-24T16:40:57.954Z "
17+ ]
18+ ],
19+ CURLOPT_HTTPHEADER => array (
20+ "Authorization: Bearer SECRET_KEY " ,
21+ "Cache-Control: no-cache "
22+ ),
23+ ));
24+
25+ $ response = curl_exec ($ curl );
26+ $ err = curl_error ($ curl );
27+
28+ curl_close ($ curl );
29+
30+ if ($ err ) {
31+ echo "cURL Error #: " . $ err ;
32+ } else {
33+ echo $ response ;
34+ }
35+ ?>
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ url=" https://api.paystack.co/charge"
4+ authorization=" Authorization: Bearer YOUR_SECRET_KEY"
5+ content_type=" Content-Type: application/json"
6+ data=' {
7+ 8+ "amount": "10000",
9+ "bank_transfer": {
10+ "account_expires_at": "2025-04-24T16:40:57.954Z"
11+ }
12+ }'
13+
14+ curl " $url " -H " $authorization " -H " $content_type " -d " $data " -X POST
You can’t perform that action at this time.
0 commit comments