Discussing APIs and development related to customers, discounts, and order management.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi!
I am encountering an issue with the Draft Orders API endpoint (/admin/api/2024-01/draft_orders.json). When creating a draft order for a customer with a government email address (e.g., test.test@123go.gouv.qc.ca), I receive the following error:
{"errors":{"email":["contains an invalid domain name"]}}
This is perplexing because I can successfully create the customer using the Customers API endpoint (/admin/api/2023-07/customers.json) with the same email address. There seems to be a discrepancy in how the two endpoints handle government domain names.
The JSON body used for creating the draft order is as follows:
{ "draft_order": { "line_items": [{ "title": "Custom Tee", "price": "20.00", "quantity": 2 }], "applied_discount": { "description": "Custom discount", "value_type": "fixed_amount", "value": "10.0", "amount": "10.00", "title": "Custom" }, "tags": "Clinique, <sales_rep>", "customer": { "id": 'customerId' }, "billing_address": { "first_name": "Bob", "last_name": "Norman", "address1": "123 Main St", "city": "Anytown", "province": "ON", "country": "Canada", "zip": "A1B2C3", "phone": "555-555-5555" }, "shipping_address": { "first_name": "Bob", "last_name": "Norman", "address1": "123 Main St", "city": "Anytown", "province": "ON", "country": "Canada", "zip": "A1B2C3", "phone": "555-555-5555" } } }
Could you please assist in resolving this issue or provide guidance on how to handle government email domains in draft orders?
Thank you for your assistance.
Best regards,
Hey @PhilippePasquin
Thanks for flagging - have raised an issue with the Draft Orders team and will report back.
Scott | Developer Advocate @ Shopify
Hey @PhilippePasquin
From the Draft Orders team:
> Draft orders enforces a stricter level of email validation that customers does. For drafts, we check that an MX and A record exist for the domain.
Are you able to add these records?
Scott | Developer Advocate @ Shopify
Hi all, any fix to this issue yet? I'm dealing with a lot of photographers, filmmakers, and production companies that generally all have their own personal websites, with their own personal email addresses. example Johnny @johnnytakespix.net.au (but yes we also have government departments with similar address structures).
The workaround is deleting the email address from the customer details on the order before applying payment but that means I have to manually email them the invoice and they won't be able to receive any notifications from the system.
and on the odd occasion when I'm rushing to print an invoice, I might just, apply payment before putting in customer info, which bakes the "no billing address" information into the order.