Always "phone is invalid" error when performing subscriptionDraftUpdate

Hello,

We implemented our Subscriptions API solution when it was first introduced in January 2021. We’ve received alerts about deprecation of the 2021-01 API version for some time, with the deprecation date being today (July 5 2023).

We did a test of our application today and noted that calls to subscriptionDraftUpdate to update the shipping address on a Subscription Draft were resulting in an error about an invalid phone number:

[{"field":["input","deliveryMethod","shipping","address","phone"],"message":"Delivery method shipping address phone is invalid"}]

We had been passing a hard-coded 5555555555 value as the phone number. Thinking that was the problem, we’ve tried other real phone numbers, but receive the same error. We’ve submitted the same request to our old (2021-01) and several newer (2022-07, 2023-07, etc) API endpoints, but all return the same invalid phone number response.

The docs for MailingAddressInput, which “phone” is a field, notes that the value must be:

“Formatted using E.164 standard. For example, +16135551111.” We have adjusted and included the country code and tried both with and without the “+” prefix, but all give the same error response.

https://shopify.dev/docs/api/admin-graphql/2023-04/input-objects/MailingAddressInput

I’m hoping some of the Shopify staff that frequent the forum can weigh in. Regular Shopify Chat Support has submitted a request to look at the logs for us, but while we wait to hear back we wanted to reach out here as well.

Thank you!

Hi Jorge12,

This does seem to be an unusual issue. Just to confirm, when updating a subscription contract are you going through the process of creating a draft from an existing contract, updating that subscription draft and then committing the new one, as described in our docs?

Liam,

So glad you saw my post, thanks for the note. Yes, the create / update / commit workflow is what we are doing with the contract rafts. Trying to update the draft is when we experience this issue, so we are never able to commit the update.

If I can run any tests or provide timestamps as to when this has happened, please let me know.

Thanks!

I do have the same issue. An fix would be much appreciated.

Hi,

Shopify Support did a great job looking at our account and finally identified the issue for us.

We had been using the “country” field (of type String) when specifying the address for the subscription draft. However, that field was recently deprecated and replaced with “countryCode” (of type CountryCode) .

It appears that their phone number validation is based on the country, and without countryCode field present, all phone numbers return as invalid.

I hope this helps!

1 Like

Yes! It worked! Thank you!