array("regexp" => "/^[a-zA-Z\s]+$/")))) { $name_err = "Please enter a valid name."; } else { $name = $input_name; } // Validate email $input_email = trim($_POST["email"]); if (empty($input_email)) { $email_err = "Please enter an email."; } else { $email = $input_email; } // Validate phoneNumber $input_phoneNumber = trim($_POST["phoneNumber"]); if (empty($input_phoneNumber)) { $phoneNumber_err = "Please enter phoneNumber"; } else { $phoneNumber = $input_phoneNumber; } // Check input errors before inserting in database if (empty($name_err) && empty($email_err) && empty($phoneNumber_err)) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.paystack.co/plan", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => [ "name" => "Monthly Retainer", "interval" => "monthly", "amount" => 10000, "invoice_limit" => 12 ], CURLOPT_HTTPHEADER => array( "Authorization: Bearer sk_live_19e4102cac94513aa1d859688c8336cd43a623f4", "Cache-Control: no-cache" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) {?> data->plan_code; // Initialize the payment $url = "https://api.paystack.co/transaction/initialize"; $fields = [ 'email' => $email, 'amount' => 100000, 'plan' => $plan_code ]; $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 sk_live_19e4102cac94513aa1d859688c8336cd43a623f4", "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); $initialize_data = json_decode($result); if($initialize_data->status === false) {?> data->authorization_url; if($initialize_data->data) { echo $auth_url; header("Location: $auth_url"); } } } } } ?>
45
Completed
43
Wishlist
15
Certification
35
Purchased

Subscribe Here

Please fill this form to subscribe

" method="post">