Jump to content

Error 422 Unprocessable Entity


RobinSomes

Recommended Posts

Site: piscesconservation.com/cube
CC 6.4.2 / AllInOneShipping 10.0.21 / Facebook 1.0.1 / PayPal Commerce Platform 1.4.4 / PayPal Standard Gateway 1.0.8 (disabled) / ProductAddons 1.0.12 / SagePay 1.0.11

Sales of downloadable goods made using PayPal occasionally do not complete, so remain Pending. I can see in our PayPal a/c that the money has been received, and get an email to that effect. "Thank you for your payment" and "Order Confirmation #123456789XYZ" emails are sent to the customer, but no "Order Complete" or "Your Purchased Downloads" mails.

The Request Log has a series of 5 identical errors in red, from the time of the order:

 
Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/0S044361FS6103330[{"op":"replace","path":"/purchase_units/@reference_id=='***********'/amount","value":{"value":"21.60","currency_code":"GBP","breakdown":{"item_total":{"value":"21.6","currency_code":"GBP"},"shipping":{"value":"0","currency_code":"GBP"},"tax_total":{"value":"0","currency_code":"GBP"},"discount":{"value":"0","currency_code":"GBP"}}}}]
Error:cURL Error (22): The requested URL returned error: 422 Unprocessable Entity
Response received (422 - Unprocessable Entity)

I can mark the order as Completed by hand, and this triggers an "Order Complete" email being sent, but no "Your Purchased Downloads".

1: I know that the 422 - Unprocessable Entity error has been mentioned here before (https://forums.cubecart.com/topic/56248-paypal-not-finalising/?tab=comments#comment-243761) but there didn't seem to be any resolution to it, other than "get your server admin to rattle a stick up the pipe and see what comes down". Is there any advance on that?

2: Having now marked the order as Complete, how can I trigger the sending of a "Your Purchased Downloads" email, so our customer can get what he's paid for? I know I can copy/paste the download link and email it in a separate message, but it would be great if the site could do it for me, like it should.

 

TIA,

Robin

Link to comment
Share on other sites

"occasionally do not complete"

So, if most of the time there is no problem, then it can't be a condition that doesn't vary - such as a server feature (like, OpenSSL or CA certs).

Is it possible that the 'unprocessable entity' (that is, a node in the JSON string) is not formatted exactly correctly? I am looking at the value->value node value of "21.60", and comparing that to value->breakdown->item_total->value value of "21.6".

Please let us know if in admin, Store Settings, Features tab, "Allow order "Processing" status to be skipped?" is not checked.

 

 

Link to comment
Share on other sites

4 hours ago, bsmither said:

"occasionally do not complete"

So, if most of the time there is no problem, then it can't be a condition that doesn't vary - such as a server feature (like, OpenSSL or CA certs).

At a rough guess, 10% of orders transacted through the PayPal Commerce Platform stick like this, We also use Sagepay; I'm not aware of any of those transactions sticking at Pending.

4 hours ago, bsmither said:

Is it possible that the 'unprocessable entity' (that is, a node in the JSON string) is not formatted exactly correctly? I am looking at the value->value node value of "21.60", and comparing that to value->breakdown->item_total->value value of "21.6".

That does indeed seem odd...

4 hours ago, bsmither said:

Please let us know if in admin, Store Settings, Features tab, "Allow order "Processing" status to be skipped?" is not checked.

 

That is correct, it's not checked.

 

4 hours ago, bsmither said:

 

 

 

Link to comment
Share on other sites

I think it strange that CubeCart isn't emailing a Download email when the order goes to Processing - assuming there is a digital item in the cart to trigger this.

We may need to do some diagnostic analysis to determine why CubeCart is deciding not to do this.

Ten percent of orders through PayPal? If you can recall any past order (maybe examine the Request Log for other red-colored entries) that exhibited the same issue, please examine the total price to see if it ended with zeros.

 

Link to comment
Share on other sites

10 hours ago, bsmither said:

I think it strange that CubeCart isn't emailing a Download email when the order goes to Processing - assuming there is a digital item in the cart to trigger this.

We may need to do some diagnostic analysis to determine why CubeCart is deciding not to do this.

Ten percent of orders through PayPal? If you can recall any past order (maybe examine the Request Log for other red-colored entries) that exhibited the same issue, please examine the total price to see if it ended with zeros.

There are no other red entries in the Request Log, which dates back only as far as June 8th. However I can see one order on June 11th where the total price was truncated, as in our example above. That order went on to be completed successfully, and all the requisite emails were sent, so I'm not sure where that leaves us!

Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/***************[{"op":"replace","path":"/purchase_units/@reference_id=='****************'/amount","value":{"value":"44.40","currency_code":"GBP","breakdown":{"item_total":{"value":"44.4","currency_code":"GBP"},"shipping":{"value":"0","currency_code":"GBP"},"tax_total":{"value":"0","currency_code":"GBP"},"discount":{"value":"0","currency_code":"GBP"}}}}]
Response received (204 - No Content)
 
I will put through some sample orders today, and see if I can reproduce the behaviour.
 
Many thanks for your help.
Robin
 
Link to comment
Share on other sites

I've just put through one order using Microsoft Edge, and PayPal Checkout as a guest. Order completed successfully and emails sent OK; Request Log has no red entries, but the following line with the total value truncated:

Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/***********[{"op":"replace","path":"/purchase_units/@reference_id=='*************'/amount","value":{"value":"21.60","currency_code":"GBP","breakdown":{"item_total":{"value":"21.6","currency_code":"GBP"},"shipping":{"value":"0","currency_code":"GBP"},"tax_total":{"value":"0","currency_code":"GBP"},"discount":{"value":"0","currency_code":"GBP"}}}}]
Response received (204 - No Content)

Another order in the Chrome browser, PayPal Checkout as a guest. Order successful, emails OK; similar result in Request Log:

Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/**************[{"op":"replace","path":"/purchase_units/@reference_id=='*******************'/amount","value":{"value":"15.60","currency_code":"GBP","breakdown":{"item_total":{"value":"15.6","currency_code":"GBP"},"shipping":{"value":"0","currency_code":"GBP"},"tax_total":{"value":"0","currency_code":"GBP"},"discount":{"value":"0","currency_code":"GBP"}}}}]
Response received (204 - No Content)

A third order, using Chrome, PayPal Checkout, using PayPal balance. Order successful, emails OK, similar Request Log entry:

Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders************[{"op":"replace","path":"/purchase_units/@reference_id=='************'/amount","value":{"value":"10.80","currency_code":"GBP","breakdown":{"item_total":{"value":"10.8","currency_code":"GBP"},"shipping":{"value":"0","currency_code":"GBP"},"tax_total":{"value":"0","currency_code":"GBP"},"discount":{"value":"0","currency_code":"GBP"}}}}]
Response received (204 - No Content)

I'm not sure continuing with every possible combination of browser I have / PayPal as guest / PayPal as user would tell us much more, but it looks like the truncated total value, on its own, isn't the trigger for the failure.

 


 

Link to comment
Share on other sites

Do you think, along with the data shown in the Request Log entries, there are more data sent with the request - like in a POST method containing an address?

If so, could it possibly be that PayPal is not agreeing to process this request not because of faulty syntax in the data stream, but rather a questionable or suspect customer or customer address?

Which is to be asking, do we know when the entry gets logged in the Request Log? Before the customer gets sent off to the PayPal screen, or after the customer makes payment? This is a strange thing to ask, I know, as you say the order does get paid for by all other indications.

(And again, why no Download Delivery email?)

 

Link to comment
Share on other sites

1 hour ago, bsmither said:

Do you think, along with the data shown in the Request Log entries, there are more data sent with the request - like in a POST method containing an address?

If so, could it possibly be that PayPal is not agreeing to process this request not because of faulty syntax in the data stream, but rather a questionable or suspect customer or customer address?

Which is to be asking, do we know when the entry gets logged in the Request Log? Before the customer gets sent off to the PayPal screen, or after the customer makes payment? This is a strange thing to ask, I know, as you say the order does get paid for by all other indications.

(And again, why no Download Delivery email?)

 

Would it help to send you the full set of entries from the Request Log for the order? (I would post it here but there's sensitive bits of information, I guess). Perhaps one set for yesterday's stuck order, and another set from today's successful test order?

Looking at the evidence available to me for one of the test orders I made this morning, it seems to be in this order; Request Log entries in italics:

09:16:17 (GMT) - Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/   Response received (201 - Created)

09:16:58 - Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/  Response received (201 - Created)

09:18 + some unknown seconds but record below suggests 09:18:21 - Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/************ Response received (200 - OK)

09:18 + unknown seconds - Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/****************** Response received (204 - No Content)

09:20 + unknown seconds - Request Sent (cURL) - https://www.google.com/recaptcha/api/siteverify?secret=******   Response received (200 - OK){ "success": true, "challenge_ts": "2021-07-08T09:18:21Z", "hostname": "******" }

09:20 + unknown - 4 identical Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/**************[SNIPPED FOR BREVITY]{"op":"add","path":"/purchase_units/@reference_id=='*************'/invoice_id","value":"210708-092019-****"},{"op":"add","path":"/purchase_units/@reference_id=='*************'/description","value":"Payment for order 210708-092019-****"}] Response received (204 - No Content)

09:20:19 - The order was placed (judging from the order reference number 210708-092019-XXXX)

09:20:21 - Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/***********/capture  Response received (201 - Created)

09:20:22 - "Thank you for your payment!" email sent by the shop
09:20:25 - "Thank you for your payment!" email recorded in shop email log

09:20:25 - "Order Confirmation" email sent by the shop
09:20:27 - "Order Confirmation" email recorded in shop email log

09:20:27 - "New Order #210708-092019-****" email sent to my office
09:20:27 - "New Order #210708-092019-****" email recorded in shop email log

09:20:35 - "Your Purchased Downloads" email sent by the shop
09:20:37 - "Your Purchased Downloads" email recorded in shop email log

Link to comment
Share on other sites

"Would it help..."

No, I think it wouldn't, although the non-faulting entries in the various logs has some interest.

I am going to post an issue in the Github to request that additional info be logged, if present, for problematic request/responses in the PayPal module.

 

Link to comment
Share on other sites

1 hour ago, bsmither said:

"Would it help..."

No, I think it wouldn't, although the non-faulting entries in the various logs has some interest.

I am going to post an issue in the Github to request that additional info be logged, if present, for problematic request/responses in the PayPal module.

 

Thank you; great response as ever, I appreciate it. Meanwhile, if I do see any other stuck orders I shall report their circumstances here.

Thanks again,

Robin

Link to comment
Share on other sites

  • 2 weeks later...
On 7/8/2021 at 9:13 PM, bsmither said:

"Would it help..."

No, I think it wouldn't, although the non-faulting entries in the various logs has some interest.

I am going to post an issue in the Github to request that additional info be logged, if present, for problematic request/responses in the PayPal module.

 

I have just had another PayPal transaction failure, as above. The order stuck at Pending, despite payment arriving in our PayPal account correctly. There was a digital item in the cart, and no other physical goods. Marking the order as Completed sends an "Order Complete" email to the customer, but no "Your Purchased Downloads" email.

The Request Log contains 11 identical red entries, between 03:34 and 03:37 UTC, as follows:

 
Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/***************[{"op":"replace","path":"/purchase_units/@reference_id=='*************'/amount","value":{"value":"18.00","currency_code":"GBP","breakdown":{"item_total":{"value":"18","currency_code":"GBP"},"shipping":{"value":"0","currency_code":"GBP"},"tax_total":{"value":"0","currency_code":"GBP"},"discount":{"value":"0","currency_code":"GBP"}}}}]
Error:cURL Error (22): The requested URL returned error: 422 Unprocessable Entity
Response received (422 - Unprocessable Entity)

Apart from the use of the PayPal Commerce gateway, there's no obvious connection between the two customers in these stuck transactions (the first, on July 7th, was an unregistered customer in the UK, the second, this morning, was a registered customer in Chile). Each ordered a different downloadable item. The ability to send a "Your Purchased Downloads" email manually would go some way towards helping, but it's becoming frustrating and embarrassing to keep failing customers in this way. 

(Since my original query, the shop has been updated to the latest incarnations of CC and PayPal Commerce).

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...