Jump to content

paypal direct payment FIX for lack of errors


Guest krypton1

Recommended Posts

  • 3 weeks later...

Guest Steve Eilers

HI Krypton,

After applying your mod to my website I now get this error:

Fatal error: Call to undefined method SOAP_Fault::getErrors() in /home/ralix/public_html/modules/gateway/DirectPayment/form.inc.php on line 144

Any ideas why?

I am using cubecart version 3.0.8

Link to comment
Share on other sites

Guest krypton1

HI Krypton,

After applying your mod to my website I now get this error:

Fatal error: Call to undefined method SOAP_Fault::getErrors() in /home/ralix/public_html/modules/gateway/DirectPayment/form.inc.php on line 144

Any ideas why?

I am using cubecart version 3.0.8

Do you have the paypal direct payment module working by itself yet? Try getting this working first before installing the mod.

Brian

Link to comment
Share on other sites

  • 2 weeks later...
Guest hasakr

I applied this hack. I am now getting an explanation for the failed transaction:

Sorry, your order failed!

The field Shipping Address State is in an invalid format. For US/CA states and territories, enter a valid two letter state code.

You can attempt to purchase your basket contents again below:

The only problem is that the state is in a pulldown menu and is automatically a two letter code. Does anyone have an idea why I am getting this error?

Link to comment
Share on other sites

I applied this hack. I am now getting an explanation for the failed transaction:

Sorry, your order failed!

The field Shipping Address State is in an invalid format. For US/CA states and territories, enter a valid two letter state code.

You can attempt to purchase your basket contents again below:

The only problem is that the state is in a pulldown menu and is automatically a two letter code. Does anyone have an idea why I am getting this error?

I had the same problem poeple where signing up with there state name and not the two letter abv. So I change this line to look it up. I added the "or abbrev" at the end of the sql select in the form.inc.php in the paypal pro directly DirectPayment. the line on my file is 169.

// look up county

$isoLookup = $db->select("SELECT abbrev FROM ".$glob['dbprefix']."CubeCart_iso_counties WHERE name LIKE '".$ccUserData[0]['county']."' or abbrev LIKE '".$ccUserData[0]['county']."'");

Link to comment
Share on other sites

  • 2 months later...
Guest sexcityxxx

Fatal error: Call to undefined function: geterrors() in /home/content/s/e/x/sexcityxxx/html/shop/modules/gateway/DirectPayment/form.inc.php on line 157

did i do anything wrong? how come is not working on mine? using 3.0.10

Link to comment
Share on other sites

  • 3 weeks later...

In order to use the Paypal API, you must use the Direct Payments and Express Checkout together. This is required by Paypal in order to use the PayPal Pro service.

I'm not sure how they police this, but I just thought you should know.

Link to comment
Share on other sites

Fatal error: Call to undefined function: geterrors() in /home/content/s/e/x/sexcityxxx/html/shop/modules/gateway/DirectPayment/form.inc.php on line 157

did i do anything wrong? how come is not working on mine? using 3.0.10

I am getting this also, and it just started... I have not changed anything also. That is why I am here looking for an answer.

Link to comment
Share on other sites

Hi Krypton,

I am really at a loss at this point. I have tried everything in the forums, knowledgebase, etc... that relates

to "Sorry, your order failed! You can attempt to purchase your cart contents again below:". I also tried your fix.

Every order generates that same error. The orders are however, captured by the admin tool as pending.

I came across something interesting, but I'm not sure if it applies. If I enter domainexample.com/shop/confirmed.php I get a confirmation email from one of the pending orders

and the order status changes to processing.

Finally I also get the following error when trying to update the paypal direct gateway, and the paypal express gateway thru the admin panel.

"Warning: base64_encode() expects parameter 1 to be string, array given in

D:\WebSpace\resadmin\usernameexample\domainexample.com\www\shop\admin\includes\functions.inc.php on line 157" .....and then API account name field becomes blank.

Not sure if that's related either. But any help would be greatly appreciated! I am completely lost at this point, and am concerned that cubecart might not be an option. I have spent countless hours getting to this point, so givingup would be very depressing .

HELP! and Thank you.

------------------------------------------------------------------------------

Many people on this forum have comments about how the Paypal direct payment gateway has a major flaw: it doesn't provide any useful error message back to the customer when the order has failed. No matter how it fails, it says the same thing: "Order failed!". Not helpful! This could be the customers card was declined, wrong address, maybe they typed in the expiration year with 2 digits instead of 4, etc. They would never know, and probably never make the purchase!

These error messages are also quite useful when you are trying to get the module installed. If you are having trouble getting it installed, you should probably read this thread:

http://www.cubecart.com/site/forums/index....showtopic=11714

Bottom line, it is probably costing cube cart store owners a small fortune in lost orders from customers who got frustrated and just gave up!

So anyway, here is the fix. There are 3 files to edit:

1. Edit

cart\modules\gateway\DirectPayment\form.inc.php

around line 141, change

		//if(Services_PayPal::isError($response))

		//	echo $response->getMessage();



		header("Location: confirmed.php?f=1");

		exit;


to


		//	if(Services_PayPal::isError($response))

		//  echo $response->getMessage();

		

		$errs = $response->getErrors();

		$message = "";

		if(is_array($errs)){

			foreach($errs as $err){

				$m = $err->getLongMessage();

				if(substr_count($message,$m) == 0) 

					$message .= $m . "<BR>";

			}

		}else{

			$message = $errs->getLongMessage() . "<BR>";

		}



		header("Location: confirmed.php?f=1&err=".urlencode($message));

		exit;




2. Edit

cart\includes\content\confirmed.inc.php



around line 126 change


$confirmation->assign("LANG_ORDER_FAILED",$lang['front']['confirmed']['order_fail']);

		$confirmation->assign("LANG_ORDER_RETRY",$lang['front']['confirmed']['try_again_desc']);

		$confirmation->assign("LANG_RETRY_BUTTON",$lang['front']['confirmed']['try_again']);

		$confirmation->parse("confirmation.session_true.order_failed");


to


$confirmation->assign("LANG_ORDER_FAILED",$lang['front']['confirmed']['order_fail']);

		$confirmation->assign("LANG_ORDER_FAILED_ERRORS",$_GET['err']);

		$confirmation->assign("LANG_ORDER_RETRY",$lang['front']['confirmed']['try_again_desc']);

		$confirmation->assign("LANG_RETRY_BUTTON",$lang['front']['confirmed']['try_again']);

		$confirmation->parse("confirmation.session_true.order_failed");


The only thing different is one line gets inserted (the second one).



3. Edit

cart\skins\[NAME OF THE SKIN YOU ARE USING]\styleTemplates\content\confirmed.tpl



around line 20 change


<!-- BEGIN: order_failed -->

		<p>{LANG_ORDER_FAILED}</p>

		<p>{LANG_ORDER_RETRY}</p>


to


<!-- BEGIN: order_failed -->

		<p>{LANG_ORDER_FAILED}</p>

		<p><font color=red>{LANG_ORDER_FAILED_ERRORS}</font></p>

		<p>{LANG_ORDER_RETRY}</p>

Again, only the one line is inserted.

This should fix it (if not let me know, maybe I forgot something, its been a long day). I know a lot of people were offering money for this fix, but I decided to post it for free to keep with the spirit of open source cube cart. ;) Then again, I stayed up all night tonight working on it (i spent a couple hours trying to parse the paypal logs in the pear/tmp directory, until i read through the Paypal API and found this method), so if it helped you out and you are feeling generous, you are more than welcome to paypal over some thanks. My paypal email is [email protected]

Hope this helps some people!

Brian

Link to comment
Share on other sites

I did this fix and it did bring me to the Thank You..... page, BUT there was not a page between "Please choose your preferred payment method" and the "Thank you...." page so that I could put in my Credit Card.

Is there something else I should do?

------------------------------------------------

Many people on this forum have comments about how the Paypal direct payment gateway has a major flaw: it doesn't provide any useful error message back to the customer when the order has failed. No matter how it fails, it says the same thing: "Order failed!". Not helpful! This could be the customers card was declined, wrong address, maybe they typed in the expiration year with 2 digits instead of 4, etc. They would never know, and probably never make the purchase!

These error messages are also quite useful when you are trying to get the module installed. If you are having trouble getting it installed, you should probably read this thread:

http://www.cubecart.com/site/forums/index....showtopic=11714

Bottom line, it is probably costing cube cart store owners a small fortune in lost orders from customers who got frustrated and just gave up!

So anyway, here is the fix. There are 3 files to edit:

1. Edit

cart\modules\gateway\DirectPayment\form.inc.php

around line 141, change

		//if(Services_PayPal::isError($response))

		//	echo $response->getMessage();



		header("Location: confirmed.php?f=1");

		exit;


to


		//	if(Services_PayPal::isError($response))

		//  echo $response->getMessage();

		

		$errs = $response->getErrors();

		$message = "";

		if(is_array($errs)){

			foreach($errs as $err){

				$m = $err->getLongMessage();

				if(substr_count($message,$m) == 0) 

					$message .= $m . "<BR>";

			}

		}else{

			$message = $errs->getLongMessage() . "<BR>";

		}



		header("Location: confirmed.php?f=1&err=".urlencode($message));

		exit;




2. Edit

cart\includes\content\confirmed.inc.php



around line 126 change


$confirmation->assign("LANG_ORDER_FAILED",$lang['front']['confirmed']['order_fail']);

		$confirmation->assign("LANG_ORDER_RETRY",$lang['front']['confirmed']['try_again_desc']);

		$confirmation->assign("LANG_RETRY_BUTTON",$lang['front']['confirmed']['try_again']);

		$confirmation->parse("confirmation.session_true.order_failed");


to


$confirmation->assign("LANG_ORDER_FAILED",$lang['front']['confirmed']['order_fail']);

		$confirmation->assign("LANG_ORDER_FAILED_ERRORS",$_GET['err']);

		$confirmation->assign("LANG_ORDER_RETRY",$lang['front']['confirmed']['try_again_desc']);

		$confirmation->assign("LANG_RETRY_BUTTON",$lang['front']['confirmed']['try_again']);

		$confirmation->parse("confirmation.session_true.order_failed");


The only thing different is one line gets inserted (the second one).



3. Edit

cart\skins\[NAME OF THE SKIN YOU ARE USING]\styleTemplates\content\confirmed.tpl



around line 20 change


<!-- BEGIN: order_failed -->

		<p>{LANG_ORDER_FAILED}</p>

		<p>{LANG_ORDER_RETRY}</p>


to


<!-- BEGIN: order_failed -->

		<p>{LANG_ORDER_FAILED}</p>

		<p><font color=red>{LANG_ORDER_FAILED_ERRORS}</font></p>

		<p>{LANG_ORDER_RETRY}</p>

Again, only the one line is inserted.

This should fix it (if not let me know, maybe I forgot something, its been a long day). I know a lot of people were offering money for this fix, but I decided to post it for free to keep with the spirit of open source cube cart. :sourcerer: Then again, I stayed up all night tonight working on it (i spent a couple hours trying to parse the paypal logs in the pear/tmp directory, until i read through the Paypal API and found this method), so if it helped you out and you are feeling generous, you are more than welcome to paypal over some thanks. My paypal email is [email protected]

Hope this helps some people!

Brian

Link to comment
Share on other sites

I went through every fix, every forum, every support channel and it all came down to changing from a windows server to unix. And instantly the problem was solved.

that's my story

Thank you for your time :)

Link to comment
Share on other sites

  • 3 weeks later...

With this MOD, I got this error:

Fatal error: Call to undefined function: geterrors() in pcars.com/shop/modules/gateway/DirectPayment/form.inc.php on line 161

Where is this function supposed to be defined?

Link to comment
Share on other sites

  • 1 month later...
Guest LiberApertus

A word of caution about this mod. I installed it and it appeared to work; it returned the appropriate error messages when entering an expiration date in the wrong format, etc. However, I did not do a live test with the credit card actually being processed. After several complaints from customers, I discovered that after the card was charged it went back to the credit card entry screen, making the customer think nothing had happened. Then they would try to pay again, and then get an error message like this:

>The transaction was refused as a result of a duplicate invoice ID supplied.

>Attempt with a new invoice ID

So I uninstalled the mod and now everything is fine again.

I did change the language file for the "try again" message to add "or email us at [email protected] and we will help you complete your order offline." In the absence of an error message, I think this is helpful to keep the customer from feeling totally frustrated.

I'd be glad to hear any ideas of how to make this mod work successfully, but for now I'm better off without it. If you do install it, be sure to do a live test to make sure that after the card is charged it goes to the right confirmation screen.

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 months later...
Guest mashurst

any updates for 3.0.13?

Yes, this doesn't work anymore with 3.0.13 and up. I recently upgraded from 3.09 where the long error mod was working.

I'm trying to figure it out, but the files look completely different. Anyone more up on the paypal api stuff have any thoughts? Lost a big sale today and I think it would have helped to have the long error messages back.

-m :huh:

Link to comment
Share on other sites

Guest fastandlight

This looks good, but I'm running 3.0.15, and it seems that code isn't present to change in \modules\gateway\DirectPayment\form.inc.php

Any ideas?

Link to comment
Share on other sites

  • 2 months later...

I guess no one wants to update this hack?

It is so very much needed too.

I agree. I've been pulling my hair out trying to get CubeCart to work with PayPal Direct, and the lack of error feedback makes the job frustrating. Meanwhile, I installed os-commerce + the payment module and got it to work (I also had errors to correct, but at least I got good error descriptions to help along the way).

Now I'm going to take one last shot at CubeCart. If I get no joy, I'll be using the other solution, which would be a pity because CC is very straightforward and I prefer its admin area.

Link to comment
Share on other sites

Figured out the change needed to make this work with CC3.0.15!

In \modules\gateway\DirectPayment\form.inc.php

Find:

	   default:  

		  header("Location: confirmed.php?f=1");

		  exit;




Change to:


	   default: 

	   	// PAYPAL LACK OF ERRORS FIX 

		$errs = $response->getErrors();

		$message = "";

		if(is_array($errs)){

			foreach($errs as $err){

				$m = $err->getLongMessage();

				if(substr_count($message,$m) == 0) 

					$message .= $m . "<BR>";

			}

		}else{

			$message = $errs->getLongMessage() . "<BR>";

		}



		header("Location: confirmed.php?f=1&err=".urlencode($message));

		 exit;

The other files for modification is okay to do.

-Tim H.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
Guest rtiago

hi,

I have one problem, when a client try to pay with paypal, after the client put wall information of credit card and name, opens a windows that says:

Fatal error: Call to undefined function: dodirectpayment()in /home/loja69co/public_html/loja/modules/gateway/DirectPayment/form.inc.php on line 164

Why this happens???

how can i fix it???

Sorry my bad english, but i am portuguese :(:D */*

Link to comment
Share on other sites

  • 1 month later...
Guest cdtronix

hi,

I have one problem, when a client try to pay with paypal, after the client put wall information of credit card and name, opens a windows that says:

Fatal error: Call to undefined function: dodirectpayment()in /home/loja69co/public_html/loja/modules/gateway/DirectPayment/form.inc.php on line 164

Why this happens???

how can i fix it???

Sorry my bad english, but i am portuguese :);)*/*

ive just signed up for this, mainly for the virtual terminal and being able to take payments over the phone. currenlty im using paypal IPN for processing payments via my CC 3.016 site and all is fine. I would like to implement the paypal express payment into my site but reading up that so many people are having issues and problems with it i think i might just leave it be for now.

Can anyone give me a general update to if this is worth trying out or not at the moment or best to wait until its fully supported by paypal ?

as said i only really signed up for payments via the phone so its not a major importnace to us right now but would look better if we could handle the payments direclty on the site.

Link to comment
Share on other sites

Guest kaskudoo

i use paypal US for a year now - had problems in the beginning, but not at all the last 9 month.

i cannot speak for paypal UK - but the newer version of cubecart will support paypal UK completely and the modules have been rewritten and been certified by paypal ....

so, you might want to take a look at the comparison chart of cubecart v3 vs v4 and determine if its worth the upgrade for you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...