Discussing APIs and development related to customers, discounts, and order management.
Hi,
This is a new bug we're experiencing.
We're importing orders from Google Express. Google Express gives shoppers the option to maintain their privacy by automatically generating a Google-assigned email address for each order. However, Shopify's Orders API is rejecting these orders, claiming that the emails are invalid. We have quite a few shops using our app to help them import orders from Google to Shopify, and this new problem is leading them to abandon the app.
A sample email address is: customer.k8awoazf@express.google.com
Please help!
What would a sample create order API call look like?
Trying a regular POST on orders endpoint with following body
{ "order": { "email": "customer.al8undyA1@foo.test.com", "line_items": [ { "title": "Coffee", "price": 35.00 } ] } }
I have no issues with the email format.
It's not so much the email format, Shopify is actually doing some strange email validation. Every email with an @express.google.com email is rejected as invalid.
There are (multiple) error logs for different orders like this:
{ Error: failed [422] {"errors":{"customer":["Email is invalid"]}} response: 2019-02-10T15:16:55.676Z { statusCode: 422, 2019-02-10T15:16:55.720Z content: '{"errors":{"customer":["Email is invalid"]}}', 2019-02-10T15:16:55.741Z headers: 2019-02-10T15:16:55.764Z { server: 'nginx', 2019-02-10T15:16:55.784Z date: 'Sun, 10 Feb 2019 15:16:55 GMT', 2019-02-10T15:16:55.804Z 'content-type': 'application/json; charset=utf-8', 2019-02-10T15:16:55.824Z 'transfer-encoding': 'chunked', 2019-02-10T15:16:55.844Z connection: 'close', 2019-02-10T15:16:55.864Z 'x-sorting-hat-podid': '52', 2019-02-10T15:16:55.884Z 'x-sorting-hat-podid-cached': '0', 2019-02-10T15:16:55.905Z 'x-sorting-hat-shopid': '13056011', 2019-02-10T15:16:55.925Z 'x-sorting-hat-privacylevel': 'default', 2019-02-10T15:16:55.945Z 'x-sorting-hat-featureset': 'default', 2019-02-10T15:16:55.965Z 'x-sorting-hat-section': 'pod', }
I was also getting strange validation messages for what I thought were perfectly valid email addresses. Turns out Shopify is also validating the DNS. So even if the email is valid from an RFC point of view you will get the error message if the DNS lookup fails - e.g. foo@example.org.