diff --git a/src/api/preauthorization/capture/index.php b/src/api/preauthorization/capture/index.php new file mode 100644 index 0000000..f2d9b20 --- /dev/null +++ b/src/api/preauthorization/capture/index.php @@ -0,0 +1,30 @@ + '123-abc' + 'currency' => 'ZAR' + 'amount' => '10000' + ]; + + $fields_string = http_build_query($fields); + + //open connection + $ch = curl_init(); + + //set the url, number of POST vars, POST data + curl_setopt($ch,CURLOPT_URL, $url); + curl_setopt($ch,CURLOPT_POST, true); + curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Authorization: Bearer SECRET_KEY", + "Cache-Control: no-cache", + )); + + //So that curl_exec returns the contents of the cURL; rather than echoing it + curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); + + //execute post + $result = curl_exec($ch); + echo $result; +?> \ No newline at end of file diff --git a/src/api/preauthorization/initialize/index.php b/src/api/preauthorization/initialize/index.php new file mode 100644 index 0000000..dec02f4 --- /dev/null +++ b/src/api/preauthorization/initialize/index.php @@ -0,0 +1,30 @@ + '123-abc' + 'currency' => 'ZAR' + 'amount' => '10000' + ]; + + $fields_string = http_build_query($fields); + + //open connection + $ch = curl_init(); + + //set the url, number of POST vars, POST data + curl_setopt($ch,CURLOPT_URL, $url); + curl_setopt($ch,CURLOPT_POST, true); + curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Authorization: Bearer SECRET_KEY", + "Cache-Control: no-cache", + )); + + //So that curl_exec returns the contents of the cURL; rather than echoing it + curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); + + //execute post + $result = curl_exec($ch); + echo $result; +?> \ No newline at end of file diff --git a/src/api/preauthorization/release/index.php b/src/api/preauthorization/release/index.php new file mode 100644 index 0000000..51629a6 --- /dev/null +++ b/src/api/preauthorization/release/index.php @@ -0,0 +1,28 @@ + '123-abc' + ]; + + $fields_string = http_build_query($fields); + + //open connection + $ch = curl_init(); + + //set the url, number of POST vars, POST data + curl_setopt($ch,CURLOPT_URL, $url); + curl_setopt($ch,CURLOPT_POST, true); + curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Authorization: Bearer SECRET_KEY", + "Cache-Control: no-cache", + )); + + //So that curl_exec returns the contents of the cURL; rather than echoing it + curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); + + //execute post + $result = curl_exec($ch); + echo $result; +?> \ No newline at end of file diff --git a/src/api/preauthorization/reserve/index.php b/src/api/preauthorization/reserve/index.php new file mode 100644 index 0000000..b9eb424 --- /dev/null +++ b/src/api/preauthorization/reserve/index.php @@ -0,0 +1,31 @@ + 'test@paystack.com', + 'currency' => 'ZAR', + 'amount' => 1000, + 'authorization_code' => 'AUTH_dalhwqi5vw', + ]; + + $fields_string = http_build_query($fields); + + //open connection + $ch = curl_init(); + + //set the url, number of POST vars, POST data + curl_setopt($ch,CURLOPT_URL, $url); + curl_setopt($ch,CURLOPT_POST, true); + curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Authorization: Bearer SECRET_KEY", + "Cache-Control: no-cache", + )); + + //So that curl_exec returns the contents of the cURL; rather than echoing it + curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); + + //execute post + $result = curl_exec($ch); + echo $result; +?> \ No newline at end of file diff --git a/src/api/preauthorization/verify/index.php b/src/api/preauthorization/verify/index.php new file mode 100644 index 0000000..2dc4fc6 --- /dev/null +++ b/src/api/preauthorization/verify/index.php @@ -0,0 +1,28 @@ + "https://api.paystack.co/preauthorization/verify/:reference", + 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 SECRET_KEY", + "Cache-Control: no-cache", + ), + )); + + $response = curl_exec($curl); + $err = curl_error($curl); + + curl_close($curl); + + if ($err) { + echo "cURL Error #:" . $err; + } else { + echo $response; + } +?> \ No newline at end of file