The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Passing transaction info back to thank you page after Paypal transaction - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: Passing transaction info back to thank you page after Paypal transaction (/showthread.php?tid=655)



Passing transaction info back to thank you page after Paypal transaction - filch - Apr 14th, 2010

I am trying to get the transaction data available to my success/thankyou page but am not having luck. I have tried turning Pass thru on in the admin but do not get what I have turned on. I have tried the unique_key stuff but also get nothing. How can I get the PayPal transaction id and various other things like the amount and data and time etc and can the transaction id be saved to the database with the rest of the form submission data? I read somewhere in the tutorials that the database gets uploaded with some indication that the transaction was successful or paid but cannot find out where or how to do it.

Dave


RE: Passing transaction info back to thank you page after Paypal transaction - jkeisers - Apr 15th, 2010

The transaction data have to come form PayPal, because you don't know whether or not an order resulted in a transaction until you know that the customer has paid for the order.

PayPal's PDT is something you could use for your Thank You page. The code below displays the transaction data on a page, and sends you an e-mail. PDT, however, does not always work. It depends on certain ccount settings, and with certain settings the mechanism is triggered by a customer clicking the 'Return to My Site' button, which doesn't always happen.

PayPal's IPN is normally used to update the inventory and transactions database. It is often too slow to be used in real time.

PHP Code:
<?php
//PDT
// read the post from PayPal system and add 'cmd'
$req 'cmd=_notify-synch';
$tx_token $_GET['tx'];
$auth_token "token goes here";
$req .= "&tx=$tx_token&at=$auth_token";

// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " strlen($req) . "\r\n\r\n";
$fp fsockopen ('www.paypal.com'80$errno$errstr30);
// $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp$header $req);
// read the body data
$res '';
$headerdone false;
while (!
feof($fp)) {
$line fgets ($fp1024);
if (
strcmp($line"\r\n") == 0) {
// read the header
$headerdone true;
}
else if (
$headerdone)
{
// header has been read. now read the contents
$res .= $line;
 }
}

// parse the data
$lines explode("\n"$res);
$keyarray = array();
if (
strcmp ($lines[0], "SUCCESS") == 0) {
for (
$i=1$i<count($lines);$i++){
list(
$key,$val) = explode("="$lines[$i]);
$keyarray[urldecode($key)] = urldecode($val);
}

// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment

$firstname $keyarray['first_name'];
$lastname $keyarray['last_name'];
$payer_email $keyarray['payer_email'];
$amount $keyarray['mc_gross'];
$tax $keyarray['tax'];
$discount $keyarray['discount'];
$payment_date $keyarray['payment_date'];
$payment_status $keyarray['payment_status'];
$payment_type $keyarray['payment_type'];
$pending_reason $keyarray['pending_reason'];
$mc_currency $keyarray['mc_currency'];
$transactionid $keyarray['txn_id'];

echo (
"<p><strong>Payment Details</strong></p>\n");
echo (
"<ul>\n");
echo (
"<li><em>Name</em>: $firstname $lastname ($payer_email)</li>\n");
echo (
"<li><em>Amount</em>: $amount</li>\n");
echo (
"<li><em>Tax</em>: $tax</li>\n");
if (
$discount <> '0' && $discount <> "") {
echo (
"<li><em>Discount</em>: $discount</li>\n");
}
echo (
"<li><em>Date</em>: $payment_date</li>\n");
echo (
"<li><em>Payment status</em>: $payment_status</li>\n");
echo (
"<li><em>Transaction ID</em>: $transactionid</li>\n");
echo (
"</ul>\n");

// send e-mail
$today date("F j, Y, g:i a");
mail("me@myemail.com""PayPal Payment Data Transfer""PDT successfully executed on $today \n Payment Details \n Name: $firstname $lastname \n Amount: $amount \n payer_email: $payer_email \n tax: $tax \n discount: $discount \n payment_date: $payment_date \n payment_status: $payment_status \n payment_type: $payment_type \n pending_reason: $pending_reason \n mc_currency: $mc_currency \n Transaction ID: $transactionid \n""From: My Company Payment Data Transfer <info@mycompany.com>");
}
else if (
strcmp ($lines[0], "FAIL") == 0) {
// log for manual investigation
 
}
}
fclose ($fp);
?>



RE: Passing transaction info back to thank you page after Paypal transaction - kduncan - May 22nd, 2010

I'm not a top level programmer but I was able to get back data on my thank you/success page by making the following modification to my success.php file. (it is included in the files you download for a paypal form)

<?php
$curr_folder = dirname(__FILE__);
require_once("$curr_folder/includes/library.php");

require_once("../path to your/global/api/api.php"); //change this to point to your api.php file in the global folder.

$fields = ft_api_init_form_page();

$submission_id = $fields["form_tools_submission_id"]; //pulls in the submission id.

$submission_info = ft_get_submission_info(your form id, $submission_id); //replace this with the value of your form id. You can find this in formtools.

//pull in your form fields

$yourfieldname = $submission_info["yourfieldname"]; // use this construct to get all the field names you wish to display to the user.

ft_api_clear_form_sessions();
?>

Hope this helps. Any improvements to the code is more than welcome.


RE: Passing transaction info back to thank you page after Paypal transaction - kduncan - May 27th, 2010

Hello All,

After some testing I revised the code to the following.

<?php
$curr_folder = dirname(__FILE__);
require_once("$curr_folder/includes/library.php");
$fields = ft_api_init_form_page();
$firstname = $fields["firstname"]; // first name
$transid = $fields["form_tools_submission_id"]; // userid
$city = $fields["city"]; // city
$state = $fields["state"]; // state
$zip = $fields["zip"]; // zip
$amount = $fields["amount"]; // amount
ft_api_clear_form_sessions();
?>


(May 22nd, 2010, 11:00 PM)kduncan Wrote: I'm not a top level programmer but I was able to get back data on my thank you/success page by making the following modification to my success.php file. (it is included in the files you download for a paypal form)

<?php
$curr_folder = dirname(__FILE__);
require_once("$curr_folder/includes/library.php");

require_once("../path to your/global/api/api.php"); //change this to point to your api.php file in the global folder.

$fields = ft_api_init_form_page();

$submission_id = $fields["form_tools_submission_id"]; //pulls in the submission id.

$submission_info = ft_get_submission_info(your form id, $submission_id); //replace this with the value of your form id. You can find this in formtools.

//pull in your form fields

$yourfieldname = $submission_info["yourfieldname"]; // use this construct to get all the field names you wish to display to the user.

ft_api_clear_form_sessions();
?>

Hope this helps. Any improvements to the code is more than welcome.



RE: Passing transaction info back to thank you page after Paypal transaction - martine4161 - Jun 1st, 2010

I think Paypal have facility of display everything about the transaction. And if you can't get that then you can make changes in coding that all the data of the transaction will be displayed on the site and only final amount goes to the paypal. That can helps you a lot.


RE: Passing transaction info back to thank you page after Paypal transaction - Desy231 - Dec 4th, 2017

Hello. I am new to these issues, I will be happy with any information.


RE: Passing transaction info back to thank you page after Paypal transaction - Tysonlleher - Sep 3rd, 2021

General discussion is about the passing transaction information ck to thanks you page after PayPal transaction. I am trying to get the best transaction at that is available o my success that is a essayontime thank you page that is not having the luck in nature.