Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

Issue with Shopify Draft Orders API - Invalid Domain Name Error for Government Email

PhilippePasquin
Shopify Partner
3 0 0

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,


Philippe Pasquin
Shopify Partners & Shopify Expert

mobilePhone +1 438-793-8795
emailAddress p@pasquin.ca
website pasquin.ca
address 1206-1740 Rue St-Patrick, Montréal, QC


facebook
linkedin
Planifier un appel
Référez un client et recevez 200$*
Replies 2 (2)

SBD_
Shopify Staff
1776 263 383

Hey @PhilippePasquin 

 

Thanks for flagging - have raised an issue with the Draft Orders team and will report back.

Scott | Developer Advocate @ Shopify 

SBD_
Shopify Staff
1776 263 383

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