Jump to content
nemike

Help capturing data sent to Paypal

Recommended Posts

Sorry if this is the wrong place to ask, please redirect me if there is a better place to ask for help.

Occasionally we run into a customer who says they are seeing the "Things don't appear to be working at the moment.  Please try again later" message from paypal once the transaction is handed off from our server to paypal.  And the url has a code=BAD_INPUT_ERROR in it.  I was able to get some information from the customer and have found that some combination of the items they are trying to purchase is causing this problem, but I can't seem to narrow it to only one item.  I removed items until it started accepting the transaction but then just putting that same item in the cart alone did not trigger the problem.  So I'm asking how I can capture (ie debug) what data is sent to paypal so I can determine if we have something weird going on in the data.

Thanks, Mike

Share this post


Link to post
Share on other sites

Well I found the problem, but not sure how to fix it yet, will probably search around in the paypal code...  The problem is the (for a lack of what to call it) purchase description can only by a max of 127 characters, but the we are sending the entire purchase list in that field and if the customer orders enough items it overflows that field and then paypal complains.

Share this post


Link to post
Share on other sites

Just an FYI, I’ve seen that error several times when purchasing a ticket on Air Canada’s website and paying by PayPal. Sometimes the page flashes the error and then refreshes on its own and shows the confirmation, other times I get a blank screen after the error flashes… but the payment is always processed on both ends. 
Not a fix, but hope it helps with your troubleshooting knowing (in my case) the payment does go through. 

Share this post


Link to post
Share on other sites
8 hours ago, nemike said:

purchase description can only by a max of 127 characters

As I recall that was a problem with older paypal modules. If you are using the latest version of the Paypal App then you should install that first.

Share this post


Link to post
Share on other sites

Jack_mcs any idea where that fix might have been put?  Is there a git repository with the code and a possible fix that I can look at?  I can not upgrade as a completely new commerce site would have to be done.  I am trying to find the code to fix this myself, if nothing else I was going to truncate the field and end it with ...

Thanks, Mike

Share this post


Link to post
Share on other sites

@nemikeThere's no fix for the older paypal modules. You need to install the Paypal App. I can't  guarantee that will fix it but it works in many, many shops so I think it probably will. To install it, you have to download the App from the addon site, install it and then update it in your admin. Then you have to replace the cert file with the most recent one.

Share this post


Link to post
Share on other sites

Actually I found the code and fixed it and now all transactions that were failing are now working, for anyone else on old code like me here is the fix:

edit includes/modules/payment/paypal.php

inside the function "formFields"

add a line after:

        $item_number = '';
        for ($i=0; $i<sizeof($order->products); $i++) $item_number .= ' '.$order->products[$i]['name'].' ,';
        $item_number = substr_replace($item_number,'',-2);

This is the new line to add after:

        if( strlen($item_number) > 127 ) { $item_number = substr($item_number, 0, 124) . "..."; }

That fixes the problem.

Hope this helps someone.

Mike

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×