PayPal commerce error: "Expected an order id to be passed" showing in 4.70.5

7 months ago
Hi

In the "Zip / postal code" field in Shipping Settings, we had an extra space after the postal code numbers. This caused the Paypal to throw the exception. "9524 " instead of "9524"

Maybe the plugin should do a TRIM on the fields that are sensitive to validation by PayPal?


Nop.Core.NopException: Failed request (BadRequest): Request is not well-formed, syntactically incorrect, or violates schema.
{
  "name": "INVALID_REQUEST",
  "message": "Request is not well-formed, syntactically incorrect, or violates schema.",
  "debug_id": "fe255adebac0a",
  "details": [
    {
      "field": "/purchase_units/@reference_id=='default'/supplementary_data/card/level3/ships_from_postal_code",
      "value": "9524 ",
      "location": "body",
      "issue": "must match \"^[a-zA-Z0-9_'.-]*$\"",
      "description": null
    }
  ],
  "links": [
    {
      "title": null,
      "href": "https://developer.paypal.com/docs/api/orders/v2/#error-must match \"^[a-zA-Z0-9_'.-]*$\"",
      "method": null,
      "rel": "information_link",
      "encType": "application/json",
      "mediaType": null
    }
  ]
}
7 months ago
All settings in the admin area are trimming when saving, no need to trim it again in the plugin. Just try to save your shipping zip code again.
7 months ago
Hi RomanovM, we get same issue in nopCommerce 4.50.2 version
Any specific solution please

Paypal commerce plugin : Version: 1.10.6
https://prnt.sc/T1_PVcnnwya7

https://github.com/nopSolutions/nopCommerce/issues/4427#issuecomment-2650619691
7 months ago
nopCypher wrote:
we get same issue in nopCommerce 4.50.2 version


Check the log for error details. "Expected an order id to be passed" is the common error text returned by PayPal. And it's worth opening a new topic describing your problem.
1 month ago
Hey, NopCommerce team!
Yesterday I faced the same Paypal API issue as described, but related to image_url. I use NopCommerce 4.80.4, and checkouts used to pass with PaypalCommerce plugin. Now any attempt to checkout gives "invalid request" error.
I verified Paypal documentation and it says that image_url should be absolute URL, not relative. However, the plugin provides relative image URLs. I patched the plugin to get absolute image URLs and tested - it solved the problem.
Is it possible that Paypal tightened their requirements for image_url recently?
1 month ago
Actually, PayPal always required an absolute path for images and for the plugin to work correctly, it was necessary to enable setting MediaSettings.UseAbsoluteImagePath in the store. Maybe you changed it recently?
Also, check this forum topic.
1 hour ago
We're seeing the same issue in nopCommerce v 4.80.6. We've tried everything we can think of to resolve the problem but no having any luck.
1 hour ago
Which field is causing the problem for you (see in Log)?
1 hour ago
Nop.Core.NopException: Failed request (BadRequest): Request is not well-formed, syntactically incorrect, or violates schema.
{
  "name": "INVALID_REQUEST",
  "message": "Request is not well-formed, syntactically incorrect, or violates schema.",
  "debug_id": "f9813197001b2",
  "details": [
    {
      "field": "/purchase_units/@reference_id=='default'/payee/merchant_id",
      "value": "4831907276355701123",
      "location": "body",
      "issue": "INVALID_STRING_LENGTH",
      "description": "The value of a field is either too short or too long."
    },
    {
      "field": "/purchase_units/@reference_id=='default'/payee/merchant_id",
      "value": "4831907276355701123",
      "location": "body",
      "issue": "INVALID_PARAMETER_SYNTAX",
      "description": "The value of a field does not conform to the expected format."
    },
    {
      "field": "/purchase_units/@reference_id=='default'/supplementary_data/card/level3/ships_from_postal_code",
      "value": "DE14 1TR",
      "location": "body",
      "issue": "must match \"^[a-zA-Z0-9_'.-]*$\"",
      "description": null
    }
  ],
  "links": [
    {
      "title": null,
      "href": "https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_PARAMETER_SYNTAX",
      "method": null,
      "rel": "information_link",
      "encType": "application/json",
      "mediaType": null
    },
    {
      "title": null,
      "href": "https://developer.paypal.com/docs/api/orders/v2/#error-must match \"^[a-zA-Z0-9_'.-]*$\"",
      "method": null,
      "rel": "information_link",
      "encType": "application/json",
      "mediaType": null
    },
    {
      "title": null,
      "href": "https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_STRING_LENGTH",
      "method": null,
      "rel": "information_link",
      "encType": "application/json",
      "mediaType": null
    }
  ]
}
39 minutes ago
ships_from_postal_code contains space, while regex doesn't allow that. I couldn't find reference to this regex in paypal documentation, however.
Merchant_id is longer than 13 symbols.
https://developer.paypal.com/docs/api/payments/v2/