lukefred76
Technical User
Hi,
I need help to finish this pdt intergration.
I've been working with the following code which is fab but i need it to do one final thing. The code is this...
This is great but i would like to know how I can display the name of each item that was included in the order.
PP returns [item_name1] => A shoe, [item_name2] => A Sock
etc etc
How would count and display the name of each item that was in the basket.
Thank you for any help you can provide
bl
I need help to finish this pdt intergration.
I've been working with the following code which is fab but i need it to do one final thing. The code is this...
Code:
$this_url = $_SERVER["REQUEST_URI"];
$var_set = explode("?", $this_url);
$paypal_transaction_token = '';
$payment_status = '';
$payment_amount = '';
$payment_currency = '';
$payment_item = '';
if(count($var_set) > 1) {
$paras = explode("&",$var_set[1]);
for($i = 0; $i < count($paras); $i++) {
$tmp_vals = explode('=', $paras[$i]);
if($tmp_vals[0] == 'tx') {
$paypal_transaction_token = $tmp_vals[1];
}
if($tmp_vals[0] == 'st') {
$payment_status = $tmp_vals[1];
}
if($tmp_vals[0] == 'amt') {
$payment_amount = $tmp_vals[1];
}
if($tmp_vals[0] == 'cc') {
$payment_currency = $tmp_vals[1];
}
if($tmp_vals[0] == 'item_number') {
$payment_item = $tmp_vals[1];
}
}
}
/* Part - 1 */
$req = 'cmd=_notify-synch';
$req .= "&tx=$paypal_transaction_token&at=dAU7Pab_oaiVwQTep9ha8l8ZJRnNG_ss50f69zT8a-iDU91uX-wFN2ROaDu"; // test key
/* Part - 2 */
$ipnexec = curl_init();
curl_setopt($ipnexec, CURLOPT_URL, "[URL unfurl="true"]https://www.sandbox.paypal.com/webscr&");[/URL] // test url
//curl_setopt($ipnexec, CURLOPT_URL, '[URL unfurl="true"]https://www.paypal.com/cgi-bin/webscr');[/URL] // 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);
/* Part - 3 */
$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') {
print_r($value_array);
foreach($value_array as $key => $value) {
$$key = $value;
}
echo "Thank you your order is complete<br />";
echo "Invoice Number $invoice";
echo "<br /><br /><br /><br /><br />";
This is great but i would like to know how I can display the name of each item that was included in the order.
PP returns [item_name1] => A shoe, [item_name2] => A Sock
etc etc
How would count and display the name of each item that was in the basket.
Thank you for any help you can provide
bl