Paypal Code for php to sandbox developer account – working code

Php Paypal have two type’s

1) standard

2) Professional

If You want Real Time Paypal Code You Just Remove the all Code of “sandbox” this Keywords only.

1) standard

  • index.php
  • lunch.php

index.php


<?php
session_start();
$desc = 'hidsdsf';//set to the order description to be appear on the PayPal website;
$orderno = '1001';//set to unique order number;
$nettotal = '12';//set to productTotal + shipmentFee + tax;
$_SESSION["ss_last_orderno"] = $orderno;

//Save order information to database using the unique order number with status set as Pending...


$url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; //Test
//$url = "https://www.paypal.com/cgi-bin/webscr"; //Live
//$ppAcc = "ram.fobess@gmail.com"; //PayPal account email
$ppAcc = "ram.fobess@outlook.com"; //PayPal account email
$cancelURL = "http://localhost/final/paypal_cancel.php";
//$returnURL = "http://localhost/final/return.php";
$returnURL = "http://localhost/final/lunch.php";
//$notiesURL = "http://localhost/final/returnfinal.php"; "<input type='hidden' name='notify_url' value='$notiesURL'>\n".

$buffer =
"<form action='$url' method='post' name='frmPayPal'>\n".
"<input type='hidden' name='business' value='$ppAcc'>\n".
"<input type='hidden' name='cmd' value='_xclick'>\n".
"<input type='hidden' display='1' value='permonth'>\n".
"<input type='hidden' name='item_name' value='$desc'>\n".
"<input type='hidden' name='item_number' value='$orderno'>\n".
"<input type='hidden' name='amount' alt='per month' value='$nettotal'>\n".
"<input type='hidden' name='no_shipping' value='1'>\n".
"<input type='hidden' name='currency_code' value='USD'>\n".
"<input type='hidden' name='handling' value='0'>\n".
"<input type='hidden' name='cancel_return' value='$cancelURL'>\n".
"<input type='hidden' name='return' value='$returnURL'>\n".

"</form>\n".
"<script language='javascript'>document.frmPayPal.submit();</script>\n";

echo($buffer);
?>

2) lunch.php


<?php

$tx = $_GET['tx'];
$paypal_transaction_token='';
$ram='';


//$req='https://www.paypal.com/cgi-bin/webscr?cmd=_notify-synch&tx='.$tx.'&at=xOinSsTi_xSCpUFdFylEIQn1fA4TF4dwBNZvF57Zv5YuHSrlEeXwcE_Aj8i';
$req = 'cmd=_notify-synch';
// echo   $req .= '&tx='.$tx.''.$paypal_transaction_token.'&at=xOinSsTi_xSCpUFdFylEIQn1fA4TF4dwBNZvF57Zv5YuHSrlEeXwcE_Aj8i';  // test key
echo   $req .= '&tx='.$tx.''.$paypal_transaction_token.'&at=W_8M1cAJ-nB6M9vFr9740udmZZjaXXZyOTnA26Fz3CsRK37Vdu3aut9VS08';  // test key



$ipnexec = curl_init();
curl_setopt($ipnexec, CURLOPT_URL, "https://www.sandbox.paypal.com/webscr&"); // test url
//curl_setopt($ipnexec, CURLOPT_URL, 'https://www.paypal.com/cgi-bin/webscr'); // live url
curl_setopt($ipnexec, CURLOPT_HEADER, 0);
curl_setopt($ipnexec, CURLOPT_USERAGENT, 'Server Software: '.@$_SERVER['SERVER_SOFTWARE'].' PHP Version: '.phpversion());
curl_setopt($ipnexec, CURLOPT_REFERER, $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].@$_SERVER['QUERY_STRING']);
curl_setopt($ipnexec, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ipnexec, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ipnexec, CURLOPT_POST, 1);
curl_setopt($ipnexec, CURLOPT_POSTFIELDS, $req);
curl_setopt($ipnexec, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ipnexec, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ipnexec, CURLOPT_TIMEOUT, 30);
$ipnresult = trim(curl_exec($ipnexec));
$ipnresult = "status=".$ipnresult;
curl_close($ipnexec);



$parameter_value_array = explode("\n", $ipnresult);
$value_array =array();
foreach ($parameter_value_array as $key=>$value) {
$key_values = explode("=", $value);
$value_array[$key_values[0]] = $key_values[1];
}

if(array_key_exists("status", $value_array) && $value_array['status'] == 'SUCCESS') {

echo utf8_decode(urldecode($value_array['item_name']));
echo '<br/>';
echo utf8_decode(urldecode($value_array['quantity']));
echo '<br/>';
echo utf8_decode(urldecode($value_array['payer_email']));
echo '<br/>';

foreach($value_array as $key=>$nm){
//$ram .= print_r($value_array);
$ram .= $key .' = '.utf8_decode(urldecode($nm))."<br/>";
}
}

echo $ram;

?>

&nbsp;

2, Professional

  • index.php
  • config.php
  • process.php
  • paypal.class.php
  • paypal.php

index.php


<?php
include_once("config.php");
?>
<style type="text/css">
<!--
body{font-family: arial;color: #7A7A7A;margin:0px;padding:0px;}
.procut_item {width: 550px;margin-right: auto;margin-left: auto;padding: 20px;background: #F1F1F1;margin-bottom: 1px;font-size: 12px;border-radius: 5px;text-shadow: 1px 1px 1px #FCFCFC;}
.procut_item h4 {margin: 0px;padding: 0px;font-size: 20px;}
-->
</style>

<h2 align="center">Test Products</h2>
<div class="product_wrapper">
<table class="procut_item" border="0" cellpadding="4">
<tr>
<td width="70%"><h4>Canon EOS Rebel XS</h4>(Capture all your special moments with the Canon EOS Rebel XS/1000D DSLR camera and cherish the memories over and over again.)</td>
<td width="30%">
<form method="post" action="process.php">
<input type="hidden" name="itemname" value="Canon EOS Rebel XS" />
<input type="hidden" name="itemnumber" value="10000" />
<input type="hidden" name="itemdesc" value="Capture all your special moments with the Canon EOS Rebel XS/1000D DSLR camera and cherish the memories over and over again." />
<input type="hidden" name="itemprice" value="225.00" />
Quantity : <select name="itemQty"><option value="1">1</option><option value="2">2</option><option value="3">3</option></select>
<input class="dw_button" type="submit" name="submitbutt" value="Buy (225.00 <?php echo $PayPalCurrencyCode; ?>)" />
</form>
</td>
</tr>
</table>

<table class="procut_item" border="0" cellpadding="4">
<tr>
<td width="70%"><h4>Nikon COOLPIX</h4>(Nikon Coolpix S9050 26355 digital camera capture vibrant photos up to 12.1 megapixels)</td>
<td width="30%">
<form method="post" action="process.php">
<input type="hidden" name="itemname" value="Nikon COOLPIX" />
<input type="hidden" name="itemnumber" value="20000" />
<input type="hidden" name="itemdesc" value="Nikon Coolpix S9050 26355 digital camera capture vibrant photos up to 12.1 megapixels." />
<input type="hidden" name="itemprice" value="109.99" /> Quantity : <select name="itemQty"><option value="1">1</option><option value="2">2</option><option value="3">3</option></select>
<input class="dw_button" type="submit" name="submitbutt" value="Buy (109.99 <?php echo $PayPalCurrencyCode; ?>)" />
</form></td>
</tr>
</table>
</div>
</body>
</html>

config.php


<?php
$PayPalMode             = 'sandbox'; // sandbox or live
$PayPalApiUsername         = 'ram.fobess-facilitator_api1.gmail.com'; //PayPal API Username
$PayPalApiPassword         = '1395044451'; //Paypal API password
$PayPalApiSignature     = 'Akj85W-xY1qGwmAq7uW9rLrqfjxxAsnlaQNdtf0eBahWx1IA61GZsd5a'; //Paypal API Signature
$PayPalCurrencyCode     = 'USD'; //Paypal Currency Code
$PayPalReturnURL         = 'http://localhost/2014/process.php'; //Point to process.php page
$PayPalCancelURL         = 'http://localhost/2014/cancel_url.php'; //Cancel URL if user clicks cancel
?>

process.php


<?php
session_start();
include_once("config.php");
include_once("paypal.class.php");

$paypalmode = ($PayPalMode=='sandbox') ? '.sandbox' : '';

if($_POST) //Post Data received from product list page.
{
//Mainly we need 4 variables from product page Item Name, Item Price, Item Number and Item Quantity.

//Please Note : People can manipulate hidden field amounts in form,
//In practical world you must fetch actual price from database using item id. Eg:
//$ItemPrice = $mysqli->query("SELECT item_price FROM products WHERE id = Product_Number");

$ItemName         = $_POST["itemname"]; //Item Name
$ItemPrice         = $_POST["itemprice"]; //Item Price
$ItemNumber     = $_POST["itemnumber"]; //Item Number
$ItemDesc         = $_POST["itemdesc"]; //Item Number
$ItemQty         = $_POST["itemQty"]; // Item Quantity
$ItemTotalPrice = ($ItemPrice*$ItemQty); //(Item Price x Quantity = Total) Get total amount of product;

//Other important variables like tax, shipping cost
$TotalTaxAmount     = 2.58;  //Sum of tax for all items in this order.
$HandalingCost         = 2.00;  //Handling cost for this order.
$InsuranceCost         = 1.00;  //shipping insurance cost for this order.
$ShippinDiscount     = -3.00; //Shipping discount for this order. Specify this as negative number.
$ShippinCost         = 3.00; //Although you may change the value later, try to pass in a shipping amount that is reasonably accurate.

//Grand total including all tax, insurance, shipping cost and discount
$GrandTotal = ($ItemTotalPrice + $TotalTaxAmount + $HandalingCost + $InsuranceCost + $ShippinCost + $ShippinDiscount);

//Parameters for SetExpressCheckout, which will be sent to PayPal
$padata =     '&METHOD=SetExpressCheckout'.
'&RETURNURL='.urlencode($PayPalReturnURL ).
'&CANCELURL='.urlencode($PayPalCancelURL).
'&PAYMENTREQUEST_0_PAYMENTACTION='.urlencode("SALE").

'&L_PAYMENTREQUEST_0_NAME0='.urlencode($ItemName).
'&L_PAYMENTREQUEST_0_NUMBER0='.urlencode($ItemNumber).
'&L_PAYMENTREQUEST_0_DESC0='.urlencode($ItemDesc).
'&L_PAYMENTREQUEST_0_AMT0='.urlencode($ItemPrice).
'&L_PAYMENTREQUEST_0_QTY0='. urlencode($ItemQty).





'&NOSHIPPING=0'. //set 1 to hide buyer's shipping address, in-case products that does not require shipping

'&PAYMENTREQUEST_0_ITEMAMT='.urlencode($ItemTotalPrice).
'&PAYMENTREQUEST_0_TAXAMT='.urlencode($TotalTaxAmount).
'&PAYMENTREQUEST_0_SHIPPINGAMT='.urlencode($ShippinCost).
'&PAYMENTREQUEST_0_HANDLINGAMT='.urlencode($HandalingCost).
'&PAYMENTREQUEST_0_SHIPDISCAMT='.urlencode($ShippinDiscount).
'&PAYMENTREQUEST_0_INSURANCEAMT='.urlencode($InsuranceCost).
'&PAYMENTREQUEST_0_AMT='.urlencode($GrandTotal).
'&PAYMENTREQUEST_0_CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&LOCALECODE=GB'. //PayPal pages to match the language on your website.
'&LOGOIMG=http://www.sanwebe.com/wp-content/themes/sanwebe/img/logo.png'. //site logo
'&CARTBORDERCOLOR=FFFFFF'. //border color of cart
'&ALLOWNOTE=1';

############# set session variable we need later for "DoExpressCheckoutPayment" #######

$_SESSION['ItemName']             =  $ItemName; //Item Name
$_SESSION['ItemPrice']             =  $ItemPrice; //Item Price
$_SESSION['ItemNumber']         =  $ItemNumber; //Item Number
$_SESSION['ItemDesc']             =  $ItemDesc; //Item Number
$_SESSION['ItemQty']             =  $ItemQty; // Item Quantity
$_SESSION['ItemTotalPrice']     =  $ItemTotalPrice; //(Item Price x Quantity = Total) Get total amount of product;
$_SESSION['TotalTaxAmount']     =  $TotalTaxAmount;  //Sum of tax for all items in this order.
$_SESSION['HandalingCost']         =  $HandalingCost;  //Handling cost for this order.
$_SESSION['InsuranceCost']         =  $InsuranceCost;  //shipping insurance cost for this order.
$_SESSION['ShippinDiscount']     =  $ShippinDiscount; //Shipping discount for this order. Specify this as negative number.
$_SESSION['ShippinCost']         =   $ShippinCost; //Although you may change the value later, try to pass in a shipping amount that is reasonably accurate.
$_SESSION['GrandTotal']         =  $GrandTotal;


//We need to execute the "SetExpressCheckOut" method to obtain paypal token
$paypal= new MyPayPal();
$httpParsedResponseAr = $paypal->PPHttpPost('SetExpressCheckout', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);

//Respond according to message we receive from Paypal
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"]))
{

//Redirect user to PayPal store with Token received.
$paypalurl ='https://www'.$paypalmode.'.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token='.$httpParsedResponseAr["TOKEN"].'';
header('Location: '.$paypalurl);

}else{
//Show error message
echo '<div style="color:red"><b>Error : </b>'.urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]).'</div>';
echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';
}

}

//Paypal redirects back to this page using ReturnURL, We should receive TOKEN and Payer ID
if(isset($_GET["token"]) && isset($_GET["PayerID"]))
{
//we will be using these two variables to execute the "DoExpressCheckoutPayment"
//Note: we haven't received any payment yet.

$token = $_GET["token"];
$payer_id = $_GET["PayerID"];

//get session variables
$ItemName             = $_SESSION['ItemName']; //Item Name
$ItemPrice             = $_SESSION['ItemPrice'] ; //Item Price
$ItemNumber         = $_SESSION['ItemNumber']; //Item Number
$ItemDesc             = $_SESSION['ItemDesc']; //Item Number
$ItemQty             = $_SESSION['ItemQty']; // Item Quantity
$ItemTotalPrice     = $_SESSION['ItemTotalPrice']; //(Item Price x Quantity = Total) Get total amount of product;
$TotalTaxAmount     = $_SESSION['TotalTaxAmount'] ;  //Sum of tax for all items in this order.
$HandalingCost         = $_SESSION['HandalingCost'];  //Handling cost for this order.
$InsuranceCost         = $_SESSION['InsuranceCost'];  //shipping insurance cost for this order.
$ShippinDiscount     = $_SESSION['ShippinDiscount']; //Shipping discount for this order. Specify this as negative number.
$ShippinCost         = $_SESSION['ShippinCost']; //Although you may change the value later, try to pass in a shipping amount that is reasonably accurate.
$GrandTotal         = $_SESSION['GrandTotal'];

$padata =     '&TOKEN='.urlencode($token).
'&PAYERID='.urlencode($payer_id).
'&PAYMENTREQUEST_0_PAYMENTACTION='.urlencode("SALE").

//set item info here, otherwise we won't see product details later
'&L_PAYMENTREQUEST_0_NAME0='.urlencode($ItemName).
'&L_PAYMENTREQUEST_0_NUMBER0='.urlencode($ItemNumber).
'&L_PAYMENTREQUEST_0_DESC0='.urlencode($ItemDesc).
'&L_PAYMENTREQUEST_0_AMT0='.urlencode($ItemPrice).
'&L_PAYMENTREQUEST_0_QTY0='. urlencode($ItemQty).



'&PAYMENTREQUEST_0_ITEMAMT='.urlencode($ItemTotalPrice).
'&PAYMENTREQUEST_0_TAXAMT='.urlencode($TotalTaxAmount).
'&PAYMENTREQUEST_0_SHIPPINGAMT='.urlencode($ShippinCost).
'&PAYMENTREQUEST_0_HANDLINGAMT='.urlencode($HandalingCost).
'&PAYMENTREQUEST_0_SHIPDISCAMT='.urlencode($ShippinDiscount).
'&PAYMENTREQUEST_0_INSURANCEAMT='.urlencode($InsuranceCost).
'&PAYMENTREQUEST_0_AMT='.urlencode($GrandTotal).
'&PAYMENTREQUEST_0_CURRENCYCODE='.urlencode($PayPalCurrencyCode);

//We need to execute the "DoExpressCheckoutPayment" at this point to Receive payment from user.
$paypal= new MyPayPal();
$httpParsedResponseAr = $paypal->PPHttpPost('DoExpressCheckoutPayment', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);

//Check if everything went ok..
if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"]))
{

echo '<h2>Success</h2>';
echo 'Your Transaction ID : '.urldecode($httpParsedResponseAr["PAYMENTINFO_0_TRANSACTIONID"]);



if('Completed' == $httpParsedResponseAr["PAYMENTINFO_0_PAYMENTSTATUS"])
{
echo '<div style="color:green">Payment Received! Your product will be sent to you very soon!</div>';
}
elseif('Pending' == $httpParsedResponseAr["PAYMENTINFO_0_PAYMENTSTATUS"])
{
echo '<div style="color:red">Transaction Complete, but payment is still pending! '.
'You need to manually authorize this payment in your <a target="_new" href="http://www.paypal.com">Paypal Account</a></div>';
}

// we can retrive transection details using either GetTransactionDetails or GetExpressCheckoutDetails
// GetTransactionDetails requires a Transaction ID, and GetExpressCheckoutDetails requires Token returned by SetExpressCheckOut
$padata =     '&TOKEN='.urlencode($token);
$paypal= new MyPayPal();
$httpParsedResponseAr = $paypal->PPHttpPost('GetExpressCheckoutDetails', $padata, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode);

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"]))
{

echo '<br /><b>Stuff to store in database :</b><br /><pre>';


echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';
} else  {
echo '<div style="color:red"><b>GetTransactionDetails failed:</b>'.urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]).'</div>';
echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';

}

}else{
echo '<div style="color:red"><b>Error : </b>'.urldecode($httpParsedResponseAr["L_LONGMESSAGE0"]).'</div>';
echo '<pre>';
print_r($httpParsedResponseAr);
echo '</pre>';
}
}
?>

paypal.class.php


<?php
class MyPayPal {

function PPHttpPost($methodName_, $nvpStr_, $PayPalApiUsername, $PayPalApiPassword, $PayPalApiSignature, $PayPalMode) {
// Set up your API credentials, PayPal end point, and API version.
$API_UserName = urlencode($PayPalApiUsername);
$API_Password = urlencode($PayPalApiPassword);
$API_Signature = urlencode($PayPalApiSignature);

$paypalmode = ($PayPalMode=='sandbox') ? '.sandbox' : '';

$API_Endpoint = "https://api-3t".$paypalmode.".paypal.com/nvp";
$version = urlencode('95');

// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);

// Set the API operation, version, and API signature in the request.
$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

// Set the request as a POST FIELD for curl.
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

// Get response from the server.
$httpResponse = curl_exec($ch);

if(!$httpResponse) {
exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
}

// Extract the response details.
$httpResponseAr = explode("&", $httpResponse);

$httpParsedResponseAr = array();
foreach ($httpResponseAr as $i => $value) {
$tmpAr = explode("=", $value);
if(sizeof($tmpAr) > 1) {
$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
}
}

if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
}

return $httpParsedResponseAr;
}

}
?>

 

paypal.php


<?php
class Paypal{

public $request_method;

public $_errors = array();

protected $_credentials;
protected $_endPoint = 'https://api-3t.sandbox.paypal.com/nvp';
protected $_version = '98.0';




public function __construct($user, $pass, $signature, $paypal_server = 'sandbox', $request_method = 'file_get_contents'){
$this->_credentials = array(
'USER' => $user,
'PWD' => $pass,
'SIGNATURE' => $signature,
);

$this->request_method = $request_method;
if($paypal_server == 'live'){
$this->_endPoint = 'https://api-3t.paypal.com/nvp';
}

}

public function request($method, $params = array()){
$this->_errors = array();
if(empty($method)){
$this->_errors = array('There is no API Method');
return false;
}

$requestParams = array(
'METHOD' => $method,
'VERSION' => $this->_version
) + $this->_credentials;


$request = http_build_query($requestParams + $params); //build a query string based on the array of request parameters

if($this->request_method == 'curl'){

//build the HTTP header required by Paypal
$http_header = array(
'X-PAYPAL-SECURITY-USERID' => $this->_credentials['USER'],
'X-PAYPAL-SECURITY-PASSWORD' => $this->_credentials['PWD'],
'X-PAYPAL-SECURITY-SIGNATURE' => $this->_credentials['SIGNATURE'],
'X-PAYPAL-REQUEST-DATA-FORMAT' => 'JSON',
'X-PAYPAL-RESPONSE-DATA-FORMAT' => 'JSON'
);

//set options for CURL
$curlOptions = array (
CURLOPT_HTTPHEADER => $http_header,
CURLOPT_URL => $this->_endPoint,
CURLOPT_VERBOSE => 1,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CAINFO => dirname(__FILE__) . '/cert/cacert.pem', //CA cert file
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $request
);

$ch = curl_init();
curl_setopt_array($ch, $curlOptions);

$response = curl_exec($ch); //make the request

if(curl_errno($ch)){
$this->_errors = curl_error($ch);
curl_close($ch);
return false;
}else{
curl_close($ch);
$responseArray = array();
parse_str($response, $responseArray); //convert the response string to an array
return $responseArray;
}

}else if($this->request_method == 'file_get_contents'){

//build the HTTP header required by Paypal
$context_options = array(
"http" => array(
"method" => "POST",
"header"  => "Content-type: application/x-www-form-urlencoded\r\n" .
"X-PAYPAL-SECURITY-USERID: " . $this->_credentials['USER'] . "\r\n" .
"X-PAYPAL-SECURITY-PASSWORD: " . $this->_credentials['PWD'] . "\r\n" .
"X-PAYPAL-SECURITY-SIGNATURE: " . $this->_credentials['SIGNATURE'] . "\r\n" .
"X-PAYPAL-REQUEST-DATA-FORMAT: JSON\r\n" .
"X-PAYPAL-RESPONSE-DATA-FORMAT: JSON\r\n",
"content" => $request
)
);

$context = stream_context_create($context_options); //create context for file_get_contents
$response = file_get_contents($this->_endPoint, false, $context); //make the request

$responseArray = array();
parse_str($response, $responseArray); //convert the response string to an array
return $responseArray;

}

}
}




?>

paypal tow types

 

Related Posts

Advertisement

No comments.

Leave a Reply