Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PayPal error: Shipping postal code required #26

Closed
boboldehampsink opened this issue Jan 13, 2021 · 3 comments
Closed

PayPal error: Shipping postal code required #26

boboldehampsink opened this issue Jan 13, 2021 · 3 comments
Labels
ℹ️ status: need more info When waiting for user to supply database or more information.

Comments

@boboldehampsink
Copy link

Description

PayPal Checkout always returns with the following error logged:

{"name":"UNPROCESSABLE_ENTITY","details":[{"field":"/purchase_units/0/shipping/address/postal_code","value":"","issue":"POSTAL_CODE_REQUIRED","description":"The specified country requires a postal code"}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"bea95fd032bf0","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-POSTAL_CODE_REQUIRED","rel":"information_link","method":"GET"}]}

Additional info

  • Craft version: 3.5.17.1
  • PHP version: 7.4.14
  • Database driver & version: PostgreSQL 12.4
  • Plugins & versions: Commerce 3.2.13.2
@nfourtythree nfourtythree added ℹ️ status: need more info When waiting for user to supply database or more information. and removed bug labels Jan 13, 2021
@nfourtythree
Copy link
Collaborator

Hi @boboldehampsink

Looks like the answer might be in the question in this one. Looking at the response:

{
  "name": "UNPROCESSABLE_ENTITY",
  "details": [
    {
      "field": "/purchase_units/0/shipping/address/postal_code",
      "value": "",
      "issue": "POSTAL_CODE_REQUIRED",
      "description": "The specified country requires a postal code"
    }
  ],
  "message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
  "debug_id": "bea95fd032bf0",
  "links": [
    {
      "href": "https://developer.paypal.com/docs/api/orders/v2/#error-POSTAL_CODE_REQUIRED",
      "rel": "information_link",
      "method": "GET"
    }
  ]
}

It would appear that you are not providing a postal code (zipCode in Commerce terminology) for the shipping address and that seems to be required by PayPal for that specific country.

Hope this helps, thanks.

@boboldehampsink
Copy link
Author

Hi @nfourtythree the problem is that this appears whether I do or do not send cart info to paypal

@nfourtythree
Copy link
Collaborator

Hi @boboldehampsink

The sendCartInfo setting only relates to the line items and the cart totals breaking down.

Looking at the PayPal API docs it seems that shipping is not a required attribute. In that case, we can add a setting to allow control over whether or not the shipping information is sent to PayPal.

I feel like there needs to be a separation between the cart info and the shipping due to the way that PayPal handles some payment validation and how/what form it shows in the pop-up.

I will add this as a new feature request.

Thanks!

@nfourtythree nfourtythree changed the title PayPal always returns error on payment PayPal error: Shipping postal code required Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ℹ️ status: need more info When waiting for user to supply database or more information.
Projects
None yet
Development

No branches or pull requests

2 participants