Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: Facing issue with order create with error : Phone Invalid

Facing issue with order create with error : Phone Invalid

GkPayments
Shopify Partner
11 0 1

Hi,

We are trying to place an order using admin api with below payload and it is not going through but same payload with diff phone number is working fine

Err Payload
{"order":{"customer":{"email":"sample@gmail.com","first_name":"sample","last_name":"user"},"discount_codes":[],"email":"sample@gmail.com","financial_status":"pending","line_items":[{"variant_id":36748387909794,"quantity":1,"product_id":5855894700194}],"note_attributes":[],"payment_gateway_names":["Merchant"],"phone":"98******38","send_fulfillment_receipt":"true","send_receipt":"true","tags":"COD","taxes_included":"true","test":"false","billing_address":{"address1":"Road dfsdf","city":"FARIDABAD","country":"IN","first_name":"sample","last_name":"user","phone":"98******38"","province":"HARYANA","zip":"121005"},"shipping_address":{"address1":"Road dfsdf","city":"FARIDABAD","country":"IN","first_name":"sample","last_name":"user","phone":"98******38"","province":"HARYANA","zip":"121005"},"shipping_lines":[{"name":"Free Shipping,"title":"Free Shipping"}]}}

Error we get is
{
"errors": {
"order": [
"Phone is invalid"
]
}
}

 


Success Payload
Above payload with diff phone number

 

And if we remove phone from order level then it is working fine with shared "Err Payload" as well.

Api we are using is 

/admin/api/2023-01/orders.json



Not sure of the cause please help us debug this.

Reply 1 (1)

yuwen
Shopify Partner
8 1 1

Hi,

I also encountered this error, phone is invalid. I tried to add a country code in front of the phone number, like: "+1 40XXXXXXXX", and it works.

 

Hope this can help you!