Jump to content

PayPal eCommerce in Error Log


Claudia M
 Share

Recommended Posts

I saw these errors in my log today.  What should I do?

[02-Apr-2022 10:16:28 America/Louisville] PHP Warning:  curl_error() expects parameter 1 to be resource, null given in /home/xxxxxx/public_html/modules/plugins/paypal_commerce/paypal.class.php on line 856
[02-Apr-2022 10:16:28 America/Louisville] PHP Warning:  Failed to update PayPal Commerce Order. Curl error:  in /home/xxxxxx/public_html/modules/plugins/paypal_commerce/paypal.class.php on line 856

Link to comment
Share on other sites

The Github issue #2914 is still open, so I added this observation to that issue.

However, why PayPal failed to update the order (patched) cannot be determined from these error messages.

 

Link to comment
Share on other sites

Here's what was in red for the same time. I've x'd out personal and other info.  An order for this customer did go thru but not for this amount (value) .

Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/xxxxxxx [{"op":"replace","path":"/purchase_units/@reference_id=='xxxxxxx'/amount","value":{"value":"13.93","currency_code":"USD"}},{"op":"replace","path":"/purchase_units/@reference_id=='xxxxx'/shipping/name","value":{"full_name":"xxxx xxxxx"}},{"op":"replace","path":"/purchase_units/@reference_id==xxxxxx'/shipping/address","value":{"address_line_1":"xxxxx xx","admin_area_1":"xx","admin_area_2":"xxxxx","postal_code":"xxxxx","country_code":"US"}}]

Error: cURL Error (22): The requested URL returned error: 422

Response received (422 - Unprocessable Entity)

Link to comment
Share on other sites

This is something that is incredibly unhelpful is the "422 - Unprocessable Entity" response. At least one of these key:value pairs is not agreeable to PayPal.

There is an open issue in the Github (#2896) that asks for a solution.

Link to comment
Share on other sites

In fact, there is code to show a 422 error's description, but it never gets executed.

While waiting for the module to get updated, we can try this fix:

In paypal.class.php, line 921, find:

$GLOBALS['gui']->setError($value['description']);

On a new line after that, add:

trigger_error('Unprocessable entity reason: '.$value['description'], E_USER_WARNING);

Line 913, find this part of the statement:

array(200, 201, 202, 203, 204, 205, 206, 207, 208, 226))) {

Change that part to this part:

array(200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 422))) {

This now should paint an error banner to the customer with the description of this problem, as well as now logging that description in CubeCart's System Error Log.

Hopefully.

 

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.

 Share

×
×
  • Create New...