Page 1 of 2

Paypal Transaction Complete Error

Posted: Mon Aug 10, 2009 3:40 pm
by clj83
Hey,
Has anyone else had the problem when using PayPal PDT Gateway that when the payment is complete and you are redirected to the website it says:

"Your transaction was not completed. Either the operation was cancelled or some other error occurred. Please confirm your payment information and try again. Your cart has been emptied for your safety and convenience. Thank you for your time.

Transaction Details:"

The money goes through because I have live tested it but the order status in Order Manager stays at Proposed. This is obviously quite a big problem so if anyone does have the time to help me out I would greatly appreciate it.

I am using the latest versions of all the eCommerce suit.

Thanks

Chris

Re: Paypal Transaction Complete Error

Posted: Mon Aug 10, 2009 6:02 pm
by kendo451
I have been getting the same error today with PaypalGateway 2.0 and Orders 1.4.

This may be the blind leading the blind, but here is a checklist to make sure you have it configured correctly:

1. You have orders set up on a certain page with {Orders} in the content block.

2. You have a second page to receive gateway payments with {Orders}

3. In Orders preferences tab, you have set Orders to assume it is on the page in #1.

#Note - to simplify error testing, keep all of your Orders pages set to "none" except the one for Orders and the one for Invoices.

4. In Orders preferences tab, you make sure that page for Invoice display is #2, this catches your Gateway response.

5. In Orders preferences tab, at the very bottom, the PayPal PDT Gateway is selected as the gateway module.

6.  Log into your PayPal account and click on the "Profile" tab, after that page loads, click "Website Payment Preferences" in the far right column. Make sure Auto Return is set to "On".

7. In the same PayPal Website Payment Prefs page make sure the "Return URL" is to the same page as #2 above.  Double check the URL works by opening a browser window and pasting it to see if the page comes up.  I wasted hours looking for a bug when it was a typo in the page alias!  If your URL is correct a page will come up saying that you need to log in before you can do anything with your cart.  If you are logged in to the front end, it will say the cart is empty.  That means you hit the orders module on that URL which is correct.

8. In the same Paypal Website Payment Prefs page, make sure that Payment Data Transfer is "On".  Also copy the identity token string from this field and save it for step #10.

9. Save the Paypal Website Payment Preferences page.  Then click that page again to verify that all fields from #6, #7, #8 remain set correctly.

10. On your website admin, go to Extensions->Paypal PDT Gateway, in the preferences tab make sure that:
 - The payment url is correct.  If this is a live site the domain name should not have www.sandbox.paypal.com it should be www.paypal.com

11. Paste the token from step #8 into the "PDT Identity Token" field.  Also make sure your business email address is in the email field.

12. Save these preferences and then return to make sure they "stuck".

Now you have double checked that all of these fields are correct and you are still getting failed transactions like I was.  Here is something else you can do to get more info.

Create a user defined tag called "email_error" like this and make sure to put your email address where it says "youremail@yourdomain.com".

Code: Select all

//		UDT email_error
//		Sends an error to youremail@yourdomain.com

        global $gCms;
        $smarty =& $gCms->GetSmarty();
        if( !isset($gCms) ) exit;

        $email = 'youremail@yourdomain.com';
        $bodytext = $params['error'];
        
        foreach ( $params as $key => $parm ) {
        
        	$bodytext .= $key.' = '.$parm.' = '.print_r($parm).'<br />';
        }
        
        $cmsmailer =& $gCms->modules['CMSMailer']['object'];
        $cmsmailer->AddAddress($email);
        $cmsmailer->SetBody($bodytext);
        $cmsmailer->IsHTML(false);
        $cmsmailer->SetSubject('Error From Post_Gateway_Complete');
        $cmsmailer->Send();
Now in the Orders Module, go to the Payment Complete Template.  If you already have a template and have set it to default then use that one. Otherwise, create a new template and after the {else} insert this line:

Code: Select all

{email_error error=$status order=$order item=$item gateway_status=$gateway_status transaction_id=$transaction_id}
Then save the template and then make that one the default template by checking it.

Now run through a test transaction again.  When you come to the gateway complete page it will email the template variables to you.

When I do this the variables are empty, so it is making me think that there is a bug in PaypalGateway 2.0 on the return template.  But there are so many things that could be wrong that I am not confident of it yet.  So help me by testing your own setup thoroughly and posting here.

Thanks!

Re: Paypal Transaction Complete Error

Posted: Mon Aug 10, 2009 8:54 pm
by clj83
Hi Ken,

Completed everything on the checklist and it still did not work, here is what I got this time.

On the Payment Completed Page:

Array ( [id] => 18 [feu_user_id] => 5 [billing_first_name] => Chris [billing_last_name] => Johnson [billing_address1] => 1 Russet Close [billing_address2] => [billing_city] => Haverhill [billing_state] => SF [billing_postal] => CB9 9QP [billing_country] => GB [billing_phone] => [billing_fax] => [billing_email] => clj83@hotmail.com [subtotal] => 0.5 [tax] => 0 [shipping_total] => 0 [total] => 0.5 [status] => proposed [order_notes] => [cc_type] => [cc_number] => [cc_expiry] => [cc_verifycode] => [confirmation_num] => [gateway_used] => [create_date] => 2009-08-10 21:46:27 [modified_date] => 2009-08-10 21:46:27 [shipping] => Array ( [0] => Array ( [id] => 66 [order_id] => 18 [shipping_first_name] => Chris [shipping_last_name] => Johnson [shipping_address1] => 1 Russet Close [shipping_address2] => [shipping_city] => Haverhill [shipping_state] => SF [shipping_postal] => CB9 9QP [shipping_country] => GB [shipping_phone] => [shipping_fax] => [shipping_email] => clj83@hotmail.com [shipping_message] => [subtotal] => 0.5 [tax] => 0 [shipping_cost] => 0 [total] => 0.5 [weight] => 0 [create_date] => 2009-08-10 21:46:27 [modified_date] => 2009-08-10 21:46:27 [items] => Array ( [0] => Array ( [id] => 82 [order_id] => 18 [shipping_id] => 66 [item_id] => 1 [quantity] => 1 [product_name] => Birthday Card Test 1
Printed Message: None   [details] => [price] => 0.5 [weight] => 0 [status] => notshipped [create_date] => 2009-08-10 21:46:27 [modified_date] => 2009-08-10 21:46:27 ) ) ) ) ) payment_error
Your transaction was not completed. Either the operation was cancelled or some other error occurred. Please confirm your payment information and try again. Your cart has been emptied for your safety and convenience. Thank you for your time.
Transaction Details:

In the Email:
error =  = 1
order = Array = 1
item =  = 1
gateway_status = payment_error = 1
transaction_id =  = 1


I hope this information helps.

Thanks for your time
Chris

Re: Paypal Transaction Complete Error

Posted: Mon Aug 10, 2009 9:55 pm
by kendo451
I followed my own checklist and got my own working!  Ha!

You have a payment error

Posted: Mon Aug 10, 2009 9:58 pm
by kendo451
You can see on the email dump that you got that the payment gateway status returned an error.  That means PayPal did not immediately authorize the transaction.  It could be because the transaction was declined, or because it is under manual review and will be approved within an hour.

Is it possible that you don't have any money in your test buyer account?

This module is good, but needs to support the asynchronous payment notification feature so the manually approved transactions can also be handled by the backend instead of requiring manual entry.

Re: Paypal Transaction Complete Error

Posted: Tue Aug 11, 2009 6:17 am
by clj83
I have reading around the subject and have concluded that even if I could get PDT working it is probably not the best option, what we really need is IPN. Then you are notified of the payment status whether the user returns to the site or not. This page is very useful:

http://www.pdncommunity.com/pdn/board/m ... age.id=368

Do you know if it would be possible to set this up?

Chris

Re: Paypal Transaction Complete Error

Posted: Tue Aug 11, 2009 12:36 pm
by kendo451
Well, the current version of the Paypal PDT Gateway does not support IPN.  So you'd have to modify the module - which would make it "unsupportable" if when new version come out, or write a new module to add that functionality, or hire someone like Calguy to write it and publish it.

Re: Paypal Transaction Complete Error

Posted: Tue Aug 11, 2009 3:07 pm
by clj83
I have been talking to a PayPal developer helper and he suggested the following,

"The problem might be that you are using $_REQUEST to get the values back from the message sent by PayPal. I would recommend using $_GET instead, as PDT uses the GET method to send the data."

I tried changing this in the action.return_success.php file but it wont let me, just gets rewritten as the original. Do you have any ideas how I could at least test this?

Thanks

Re: Paypal Transaction Complete Error

Posted: Wed Aug 12, 2009 5:33 am
by Jeff
The PayPal developer doesn't know what he is talking about since everything from $_GET is in $_REQUEST (look at the php definitions of those var).

But if you have permissions to edit the action.return_success.php file you can change it to what ever you want. But as soon as you do it is unsupported and you are on your own.

Turn debug on (set to "true") to see more of the data from the gateway.

Re: Paypal Transaction Complete Error

Posted: Wed Aug 12, 2009 6:47 am
by clj83
Hey,
Well that is what I thought, but I ran out of other things I knew how to try. Where do I turn the debug on?

Thanks

Chris

Re: Paypal Transaction Complete Error

Posted: Wed Aug 12, 2009 6:55 am
by Jeff
edit the config.php, set debug = true

Re: Paypal Transaction Complete Error

Posted: Wed Aug 12, 2009 8:35 am
by clj83
Okay, so I have checked everything with debug and I get the following message on the return from PayPal page:

Notice: Undefined offset: 1 in /home/susa8140/public_html/modules/PaypalGateway/action.return_success.php on line 86

In action.return.success.php this is stated as:

list ($k,$v) = explode ('=',$str);

Does anyone know if this could be the problem or is an undefined offset normal?

And this error:

Notice: unserialize() [function.unserialize]: Error at offset 0 of 2536 bytes in /home/susa8140/public_html/modules/PaypalGateway/PaypalGateway.module.php on line 313

Thanks

Chris

Re: Paypal Transaction Complete Error

Posted: Wed Aug 26, 2009 7:43 pm
by kendo451
I just hired the module developer to add IPN.  It should be available in a week or so.

Re: Paypal Transaction Complete Error

Posted: Wed Aug 26, 2009 8:02 pm
by clj83
That's great news, thanks! Maybe it will work for me maybe it wont!

Re: Paypal Transaction Complete Error

Posted: Sun Sep 27, 2009 3:59 pm
by jpcarvalhinho
Hello... I am getting this same error...

I have tried the e-mail udt and the response is:

error =  = 1
order =  = 1
item =  = 1
gateway_status =  = 1
transaction_id =  = 1


I believe it has somethint to do with the return URL

On the form that leads to PAYPAL the return URL is set to:



But my return Template is

http://server.e-arte.eu/~deltacon/menus ... encomendas

CMS-1.6.5
CGPaymentGatewayBase 1.0.2
PaypalGateway 2.1.1
Orders 1.5.3

TIA for any help!