Step1:create php file named payflowpro.php
This file contains functions for update modify and create profile on payflow pro paypal account
define("VERISIGNP_VENDOR","kamlesh");
define("VERISIGNP_USER","kamlesh");
define("VERISIGNP_PWD","passsword");
define("VERISIGNP_PARTNER","PayPal");
//testing Url
define("PAYPAL_PAYFLOWPRO_URL","https://pilot-payflowpro.paypal.com");
//live Url
//define("PAYPAL_PAYFLOWPRO_URL"," https://manager.paypal.com/loginPage.do");
function processVerisignRequest($strRequest)
{
//initialise variables
$headers = array();
$strResponse = "";
$strTemp = date("YmdHIsB").rand(11,10000);
$strRequestId = md5($strTemp.$strRequest);
// Here's your custom headers; adjust appropriately for your setup:
$headers[] = "Content-Type: text/namevalue"; //or maybe text/xml
$headers[] = "X-VPS-Timeout: 45";
$headers[] = "X-VPS-VIT-OS-Name: Linux"; // Name of your OS
$headers[] = "X-VPS-VIT-OS-Version: RHEL 5"; // OS Version
$headers[] = "X-VPS-VIT-Client-Type: PHP/cURL"; // What you are using
$headers[] = "X-VPS-VIT-Client-Version: 0.01"; // For your info
$headers[] = "X-VPS-VIT-Client-Architecture: x86"; // For your info
$headers[] = "X-VPS-VIT-Integration-Product: Hound";
// For your info, would populate with application name
$headers[] = "X-VPS-VIT-Integration-Version: 0.01"; // Application version
$headers[] = "X-VPS-Request-ID: " . $strRequestId;
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
//set a curl request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, constant("PAYPAL_PAYFLOWPRO_URL"));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_HEADER, 0); // tells curl to include headers in response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 45); // times out after 45 secs
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // this line makes it work under https
curl_setopt($ch, CURLOPT_POSTFIELDS, $strRequest); //adding POST data
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); //verifies ssl certificate
curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
//forces closure of connection when done
curl_setopt($ch, CURLOPT_POST, 1); //data sent as POST
$strResponse = curl_exec($ch);
//$headers = curl_getinfo($ch); //Gets information about the last transfer
curl_close($ch);
unset($ch);
return $strResponse;
}
function makeresultarray($result)
{
$arrayresult=array();
$arrayreturn=array();
if(strlen($result)>0)
{
$arrayresult = explode("&",$result);
if(is_array($arrayresult) and count($arrayresult)>0)
foreach($arrayresult as $row)
{
$row1=explode("=",$row);
if(isset($row1[0]) and isset($row1[1]))
$arrayreturn[$row1[0]]=$row1[1];
}
}
return $arrayreturn;
}
function GetInfo($PROFILEID)
{
$trans_out_str1 = "TRXTYPE=R"."&TENDER=C";
$trans_out_str2 = "&ACTION=I".
"&PWD=".constant("VERISIGNP_PWD").
"&USER=".constant("VERISIGNP_USER").
"&VENDOR=".constant("VERISIGNP_VENDOR").
"&PARTNER=".constant("VERISIGNP_PARTNER").
"&ORIGPROFILEID=".$PROFILEID;
$args = $trans_out_str1.$trans_out_str2;
$resultinfo = processVerisignRequest($args);
//create the response array
$retresultarraynew = makeresultarray(resultinfo);
//$retresultarraynew['trans_out_str'] = $trans_out_str1.$trans_out_str2;
//$retresultarraynew['trans_in_str'] = $resultinfo;
return $resultinfo;
}
?>
Step3: Create Another file
This file will call functions from above created file
session_start();
require("payflowPayment.php");
//profileId=RT0000000001, RT0000000002
$getInfo = GetInfo ($PROFILEID);
print_r($getInfo);exit;
?>
As I get Time I will update this document for further information or contact me at below email address
Kamlesh bar email: barkamlesh@gmail.com
Ph:9067777023
Php developer, Gujarat, India