Claudia M Posted April 7, 2022 Share Posted April 7, 2022 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 Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 7, 2022 Share Posted April 7, 2022 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 7, 2022 Share Posted April 7, 2022 The Request Log in admin may have an entry that could have a clue as to why the patch failed. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted April 7, 2022 Author Share Posted April 7, 2022 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) Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 7, 2022 Share Posted April 7, 2022 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted April 7, 2022 Share Posted April 7, 2022 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. Quote Link to comment Share on other sites More sharing options...
Claudia M Posted April 7, 2022 Author Share Posted April 7, 2022 Thanks Brian ... I'll implement this asap! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.