Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help capturing data sent to Paypal


nemike

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

Link to comment
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.

Link to comment
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. 

Link to comment
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.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
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

Link to comment
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.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
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

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...