<?php
  $url = "https://api.paystack.co/transaction/initialize";

  $email = $_POST['email'];
  $phone = $_POST['phone'];
  $amount = $_POST['amount'];

  $result = $email;

   $fields = [
     'email' => $email,
     'amount' => $amount
   ];

   $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_test_3599de50c5ac7e8eb1fd322f98ea1b813d658d1f",
     "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;
?>