News:

Support the VirtueMart project and become a member

Main Menu

Paypal Transaction ID

Started by hardwaremonkey, April 12, 2011, 07:23:33 AM

Previous topic - Next topic

hardwaremonkey

I have setup a site to use PayPal (testing on developer site). I am using VM 1.1.8 on Joomla 1.5.22. The processor is paypal, not paypal_api. I am just redirecting people to PayPal for the transaction (PayPal Website Payment Standard), and just want their information when they return.

Paypal is setup to return to the notify.php page. The transaction is appropriately posting whether it is pending or complete. A P.O. is sent, as is a status update. But, I CANNOT find anywhere in Virtuemart that identifies the paypal transaction id. Does it get transferred and stored? This is my final confirmation before trusting that all is working.

THANKS!!

hardwaremonkey

I am even more stuck. I am using PP Website Payments Standard on the test server. Paypal indicates the transaction went through:

mc_gross=504.95&invoice=62_3980fb1432ee4e688b63c6b6bbaee&protection_eligibility=Eligible&address_status=confirmed&payer_id=MSAU3KWEB94AJ&tax=0.00&address_street=31962 Ansel Rd&payment_date=20:48:39 Apr 13, 2011 PDT&payment_status=Completed&charset=windows-1252&address_zip=43138&first_name=Test&mc_fee=14.94&address_country_code=US&address_name=Erik Anderson&notify_version=3.1&custom=&payer_status=verified&business=eander_1302583448_biz@surveybooth.com&address_country=United States&address_city=Logan&quantity=1&verify_sign=AiPC9BjkCyDFQXbSkoZcgqH3hpacA0BetY.XwkFOMRaB3siJqpuFJNMu&payer_email=eander_1302584070_per@surveybooth.com&txn_id=43N46561584892005&payment_type=instant&last_name=User&address_state=OH&receiver_email=eander_1302583448_biz@surveybooth.com&payment_fee=14.94&receiver_id=B9H59HTTVQCTL&txn_type=web_accept&item_name=Order Number: 11299&mc_currency=USD&item_number=&residence_country=US&test_ipn=1&handling_amount=0.00&transaction_subject=Order Number: 11299&payment_gross=504.95&shipping=5.95

Notice the txn_id. Then, Virtuemart indicates that the txn_id is received:

$vars: option => com_virtuemart
page => checkout.result
order_id => 11299
tx => 43N46561584892005
st => Completed
amt => 504.95
cc => USD
cm =>
item_number =>
fc => fcVal=5507463932839685696
ys-vmconfiguration-active => s:ext-comp-1003
ys-orderstatuspanel-active => s:ext-comp-1004
virtuemart => 65bv3885mbdqqiub32es55l4r7
114e6965f880de05486591937e230b7f => ei51gvhgsfrqvt5kiq36msl7d4
switchmenu => 1
07b9ffeb7173c95f4196423d22c62712 => i6844l90o2hnhue0uuo2ioghl4
user_info_id =>
func =>

BUT, when I check the database, there is no data for the order_payment_trans_id (or anything other than an id and payment_method_id.

What is wrong? Why is the data not being stored using the notify.php? :'(

PLEASE help. PLEASE!

hardwaremonkey

More info included. PLEASE help.

Paypal indicates the IPN transfer is successful. It has the right URL. I am using http://www.mydomain.com/nofiy.php which is a file that reads
<?php
include('administrator/components/com_virtuemart/notify.php');
?>


But, I have a php logger on for my website. While I receive information for other joomla activity, I receive nothing for an IPN transmission. I have done transaction and resends. Here is a snip regarding the log and the resend:
"14 Apr 2011 13:48:13","D:\Domains\lpfmhelp.com\wwwroot\libraries\joomla\environment\uri.php: 387","(Notice) Undefined index:  Itemid"
"14 Apr 2011 13:48:13","D:\Domains\lpfmhelp.com\wwwroot\libraries\joomla\environment\uri.php: 387","(Notice) Undefined index:  Itemid"
**finished transaction
**start resend of IPN**
**end resend of IPN***


The value data listed in the past email suggests the info is simply being taken from the URL post data as it returns to the site, but the notify.php is never called. Furthermore, while the domain sends an update the order status changing, there is never an email about an IPN transaction on the site.

My only conclusion is that the Paypal sandbox is not connecting to the website, although an HTTP 200 is reported by PayPal.

??? HELP, PLEASE... ANY IDEAS AT ALL????

At a minimum, how can I get the debug information from the notify.php to actually go somewhere (like a file) that I could read)

hardwaremonkey

The problem must be in the notify.php somewhere. I am using the most current version. (* @version $Id: notify.php 2834 2011-03-05 12:19:54Z zanardi $)

With logging turned on to the max in VirtueMart, I can see that PayPal IPN makes a call to my site...

[snip]
Subtotal: 499
Taxable: 0
Payment Discount: 0
Coupon Discount: 490
Shipping: 5.95
Shipping Tax : 0
Tax : 0
------------------------
Order Total: 14.95
----------------------------
4:12:37 AM 4/15/2011 VirtueMart [DEBUG] [222.222.222.222] [testuser] Redirect Required: false
4:12:37 AM 4/15/2011 VirtueMart [DEBUG] [222.222.222.222] [testuser] Beginning to parse the payment extra info code...
4:13:42 AM 4/15/2011 VirtueMart [DEBUG] [216.113.191.33 - ipn.paypal.com] [unknown user] A Cookie had to be set to keep the session (there was none - does your Browser keep the Cookie?) although a Session already has been started! If you see this message on each page load, your browser doesn't accept Cookies from this site.
4:13:42 AM 4/15/2011 VirtueMart [DEBUG] [216.113.191.33 - ipn.paypal.com] [unknown user] Using existing Session 07b9ffeb7173c95f4196423d22c62712, ID: ogp096df12p5pomq53vgd7ag44.
4:13:42 AM 4/15/2011 VirtueMart [DEBUG] [216.113.191.33 - ipn.paypal.com] [demo] A Cookie had to be set to keep the session (there was none - does your Browser keep the Cookie?) although a Session already has been started! If you see this message on each page load, your browser doesn't accept Cookies from this site.
4:13:42 AM 4/15/2011 VirtueMart [DEBUG] [216.113.191.33 - ipn.paypal.com] [demo] Using existing Session 07b9ffeb7173c95f4196423d22c62712, ID: ogp096df12p5pomq53vgd7ag44.
4:13:44 AM 4/15/2011 VirtueMart [DEBUG] [222.222.222.222] [testuser] Using existing Session 07b9ffeb7173c95f4196423d22c62712, ID: 4rml0scna2q709jd7p8a8kjjb4.
4:13:48 AM 4/15/2011 VirtueMart [INFO] [216.113.191.33 - ipn.paypal.com] [demo] Message sent to test user, testuser@testuser.com

But, I cannot tell what is happening on the notify.php, other than it does not appear to be doing anything.
The php log does not seem to add much to help
"15 Apr 2011 04:12:37","D:\Domains\mydomain.com\wwwroot\administrator\components\com_virtuemart\classes\ps_main.php: 773","(Notice) Undefined index:  pshop_mode"
"15 Apr 2011 00:13:44","D:\Domains\mydomain.com\wwwroot\plugins\system\plg_dndadmin.php: 62","(Notice) Undefined index:  HTTP_REFERER"
"15 Apr 2011 00:13:44","D:\Domains\mydomain.com\wwwroot\libraries\joomla\language\language.php: 338","(Warning) file_get_contents(D:\Domains\mydomain.com\wwwroot\language\en-GB\en-GB.com_virtuemart.ini) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory"
"15 Apr 2011 00:13:44","D:\Domains\mydomain.com\wwwroot\libraries\joomla\language\language.php: 338","(Warning) file_get_contents(D:\Domains\mydomain.com\wwwroot\language\en-GB\en-GB.com_virtuemart.ini) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory"


Doesn't anyone know anything about PayPal and Virtuemart and why transaction data is not being passed through notify.php?

hardwaremonkey

I modified the notify.php to determine if it was actually sending info. PayPal indicates it is a good transaction, so data is being sent AND returned. So the only issue appears to be: TRANSACTION DATA IS NOT BEING STORED IN THE DATABASE.

The data from PayPal was:
Key: mc_gross; Value: 504.95
Key: invoice; Value: 79_fc9a466f56225993f324f84dce4bd
Key: protection_eligibility; Value: Ineligible
Key: payer_id; Value: MSAU3KWEB94AJ
Key: tax; Value: 0.00
Key: payment_date; Value: 23:20:07 Apr 14, 2011 PDT
Key: payment_status; Value: Completed
Key: charset; Value: windows-1252
Key: first_name; Value: Test
Key: mc_fee; Value: 14.94
Key: notify_version; Value: 3.1
Key: custom; Value: 
Key: payer_status; Value: verified
Key: business; Value: testu_1302583448_biz@mydomain.com
Key: quantity; Value: 1
Key: verify_sign; Value: AFEp1yzjI0oAL7B0pyTwhEY2HL7mAblccggvBDaDP0WghhJK9PUQrJX9
Key: payer_email; Value: testu_1302584070_per@mydomain.com
Key: txn_id; Value: 6S166699NL406544B
Key: payment_type; Value: instant
Key: last_name; Value: User
Key: receiver_email; Value: testu_1302583448_biz@mydomain.com
Key: payment_fee; Value: 14.94
Key: receiver_id; Value: B9H59HTTVQCTL
Key: txn_type; Value: web_accept
Key: item_name; Value: Order Number: 11311
Key: mc_currency; Value: USD
Key: item_number; Value: 
Key: residence_country; Value: US
Key: test_ipn; Value: 1
Key: handling_amount; Value: 0.00
Key: transaction_subject; Value: Order Number: 11311
Key: payment_gross; Value: 504.95
Key: shipping; Value: 5.95


To discover this, I TEMPORARILY added the following code to notify.php:
// start log

$file = 'pplog.log';
$arr= $_POST;
$fp = fopen($file, 'a');
foreach ($arr as $key => $value) {
    $toFile = "Key: $key; Value: $value \n";
fwrite($fp, "$toFile");
}
fclose($fp);
//end


??? So, why is the PayPal data not being written to the database ???

hardwaremonkey

I am not a Joomla coder, and my PHP skills are decent, but not expert level. But from my "novice" perspective, what I believe I found just BLOWS ME AWAY.

It appears to me that for PayPal Website Payment Standard, that no one ever coded it to store the transaction data!

Like I said, I am not an expert. The proper fix seems like it would be to modify ps_paypal to include function for capture_payment. While I could probably figure this out, I am not the expert, and I am sure my coding would not be accepted for the final code.

SO, I made a simple hack that is sufficient for my website. I just force the creation of an Order Comment so that the order history at least has a reference number.

The exact line number, I cannot tell you, for I have hacked my notify with a bunch of debug scripting. However, somewhere around line 455, you want to add a line for 'order_comment'. I included the line above and below for reference.

                if(eregi ("Completed", $payment_status)) {
                $d['order_status'] = PAYPAL_VERIFIED_STATUS;                   
$d['order_comment'] = "PayPal Transaction ID: $txn_id for Order ID:  $order_id";
                }


Given that no one has responded to this thread and it only has a handful of readers, I do not know if anyone else will ever want to do this (although I cannot understand how others have website that function properly without storing the PayPal transaction ID). But, at least the info is here for my own reference.

hardwaremonkey

One other quick note. This little hack to the notify.php was immensely helpful and it helped me to actually post debug messages in an obvious, easy way. I just set a variable of $EAA if I wanted to log what PayPal posted, and store it a file that can be reposted in order to simulate a transaction. It may be ugly, but it works.

if ( !empty($EAA) ) {
$file = 'test-txn.html';
$arr= $_POST;
$fp = fopen($file);
$toFile = "\n<html><body><form method='post' action='/notify.php' name='myform'>\n"; 
fwrite($fp, "$toFile");
foreach ($arr as $key => $value) {
//    $toFile = "Key: $key; Value: $value \n";
    $toFile = "$key: <input name='$key' value='$value'><br> \n";
fwrite($fp, "$toFile");
}
$toFile = "<input value='Submit' name='Submit' type='submit'></form></body></html>\n";
fwrite($fp, "$toFile");
fclose($fp);
//end
}


Note:  I did manually update the database order status to return it to 'P' in order to fully test transaction processing.