Live API CODE
URL
- http://www.thecollegefever.com/api_paymenttest.php
- http://thecollegefever.com/api.php
Step 1 : Calculate Total Payment
API PHP Implementation Code
<?php
$secret_key="455e5sc2qdlyd0p0y6kgg8mx8pa5gpwykakljxmfpifrtcme2p";
$api_key="txzttklie3l7h95f6ok3722iatndlisehmfhkdu0wun9pqsv71";
$api_url="http://thecollegefever.com/thecollegefever_api_payment_test.php";
$pageURL = 'http';
$pageURL.= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL.= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL.= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
$data = array(
"secret_key"=>$secret_key,
"api_key"=>$api_key,
"task"=>"make_payment",
"user_name"=>"Kushal",
// User name
"user_uid"=>"IG150069",
// User Unique IG Number
"event_name"=>"Ignus 2015",
// Event Name
"url_origin"=>$pageURL
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $api_url,
CURLOPT_USERAGENT => 'Curl Request for making payment',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS =>$data
));
$response = curl_exec($curl);
$arrayResponse=json_decode($response);
$responseStatus=$arrayResponse->response;
$statusResult=$responseStatus->result;
if($statusResult !='error')
{
echo $arrayResponse->paidAmount;
}
else
{
echo $responseStatus->response_msg;
}
?>
Total Payment API Output :
Amount Paid by Kushal
5113
INR
Step 2 : Proceed For Payment
Payment API PHP Implementation Code
<form action='' method='POST'>
<input type='submit' value='Payment' name='methodname'/>
</form>
<?php
if(isset($_POST['methodname']))
{
if($_POST['methodname']=='Payment')
{
$secret_key="455e5sc2qdlyd0p0y6kgg8mx8pa5gpwykakljxmfpifrtcme2p";
$api_key="txzttklie3l7h95f6ok3722iatndlisehmfhkdu0wun9pqsv71";
$api_url="http://thecollegefever.com/thecollegefever_api_test.php";
$pageURL = 'http';
$pageURL.= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL.= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL.= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
$data = array(
"secret_key"=>$secret_key,
"api_key"=>$api_key,
"task"=>"make_payment",
"user_name"=>"Kushal",
// User name
"user_uid"=>"IG150069",
// User Unique IG Number
"user_email"=>"neerajnitw3@gmail.com",
// User Email Address (to get Ticket)
"user_contact_number"=>"9742350056",
// User Contact Number
"user_gender"=>"male",
// User Gender
"user_college_name"=>"jain college",
// User Collge Name
"user_pursuing_year"=>"2 nd",
// User Pursuing Year
"user_address"=>"bangalore, Karnataka",
// User Address
"user_event_registered"=>"General Fees,Accomodation",
// User registered event(Example :General Fees,Accomodation)
"user_event_charge"=>"250,650",
// Per Event charge (Example : 250,600)
"user_event_total_amount"=>"850",
// Total Charge (Example: 850)
"user_acomdation_status"=>"Pending",
// User Accomdation Status
"user_arrival_date"=>"2025/01/15",
// User Arrival Date
"user_departure_date"=>"2025/01/18",
// User Departure Date
"event_logo"=>"http://www.ignus.org/images/home/ignus_text.png",
// Event Logo
"event_admin_email"=>"cse.neeraj@gmail.com",
// Event admin email (to get user notification Ticket)
"event_name"=>"Ignus 2015",
// Event Name
"event_college_name"=>"IIT Jodhpur",
// Event College Name
"event_address"=>"IIT Jodhpur,Jodhpur",
// Event Address
"url_origin"=>$pageURL
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $api_url,
CURLOPT_USERAGENT => 'Curl Request for making payment',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS =>$data
));
$response = curl_exec($curl);
echo $response;
}
}
?>
Payment Button :