Solved

Field 'subscriptionContracts' doesn't exist on type 'Customer'

profe168
Tourist
3 1 0

 

Hi everyone.

 

I have a question about requests to the Customer Account API.

 

I want to retrieve subscriptionContract data using 'subscriptionContracts'.

However, I get the response "Field 'subscriptionContracts' doesn't exist on type 'Customer'".
and I cannot retrieve the data.

 

query MyQuery {
  customer {
    subscriptionContracts(first: 10) {
      nodes {
        id
        createdAt
        nextBillingDate
        status
      }
    }
  }
}
{
  "errors": [
    {
      "message": "Field 'subscriptionContracts' doesn't exist on type 'Customer'",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "query MyQuery",
        "customer",
        "subscriptionContracts"
      ],
      "extensions": {
        "code": "undefinedField",
        "typeName": "Customer",
        "fieldName": "subscriptionContracts"
      }
    }
  ]
}

 

Other data, such as displayname, can be retrieved with no problem.

{
  customer {
    displayName
  }
}

 

I am using Customer Account API version 2024-1.

(and using graphiql)

 

I cant figure out why this is happening, please tell me where the problem is.

 

Thank you for your support!

 

Accepted Solution (1)
profe168
Tourist
3 1 0

This is an accepted solution.

Self resolved.

I was able to get it using CustomerAccountAPI version 2024-04.

Thanks.

View solution in original post

Replies 2 (2)

profe168
Tourist
3 1 0

It seems that I can get the subscriptionContracts using adminAPI, but I would like to use customeraccountAPI if possible.

 

It seems that subscriptionContract can be obtained, but I don't know how to get the ID that is the argument.
https://shopify.dev/docs/api/customer/2024-01/objects/SubscriptionContract

 

Do I need to use adminAPI after all to get the ID?

 

I would appreciate it if you could tell me.

profe168
Tourist
3 1 0

This is an accepted solution.

Self resolved.

I was able to get it using CustomerAccountAPI version 2024-04.

Thanks.