appusageRecordCreate mutation issue

Shopify Partner
17 0 1

I'm trying the "appusageRecordCreate" mutation to accomplish our dynamic app pricing. While doing this, I'm facing a strange error that says:

 

[ { field: [ 'subscriptionLineItemId' ], message: 'Invalid id' } ]

 

This is the mutation query I'm using:

 

`mutation {
  appUsageRecordCreate(
    subscriptionLineItemId: "gid://shopify/AppSubscriptionLineItem/14869987468?v=1&index=0",
    price: { amount: 99, currencyCode: USD }
    description: "test...")

    {
    appUsageRecord {
      id
    }
    userErrors {
      field
      message
    }
  }
}

Thanks!

Wil

0 Likes
Shopify Staff
Shopify Staff
1041 140 176

Hey @Wil!

 

I was able to get this working on my end. Has the charge been activated? Is it a test charge by chance? Do you have a request ID handy?

Notice; Out of office, replies will be delayed until my return. Thanks!
0 Likes
Shopify Partner
17 0 1

Hey Scott, I was able to make it work using REST API. Shopify GraphQL documentation is poor.

 

Cheers,

Wil

Tourist
10 0 2

Hi Will,

Whats missing in author's question compared to your query? The Shopify GraphQL documentation didn't mention how/when we get the subscriptionLineItemId.

Update: Its in response from appSubscriptionCreate.

Thank you.

0 Likes
Shopify Partner
17 0 1

Hi Sravans, can you please clarify? I'm not sure I'm following.

0 Likes
Tourist
10 0 2

Back then I didn't know how to get subscriptionLineItemId. But now found it in the response from appSubscriptionCreate.

So please ignore my question, my bad.