Annual subscription Plan graphql Error: Field is not defined on AppRecurringPricingInput

Solved
naumanbashir
New Member
3 1 0

I am developing an app in laravel and trying to implement a yearly subscription plan following the tutorial available at https://shopify.dev/tutorials/create-an-annual-subscription?utm_source=gurucopy&utm_medium=link&utm_...

Despite trying everything I keep getting the following error:

Variable $lineItems of type [AppSubscriptionLineItemInput!]! was provided invalid value for 0.plan.appRecurringPricingDetails.interval (Field is not defined on AppRecurringPricingInput)

The following is my Graphql query and payload:

mutation appSubscriptionCreate(
            $name: String!,
            $returnUrl: URL!,
            $trialDays: Int,
            $test: Boolean,
            $lineItems: [AppSubscriptionLineItemInput!]!
        ) {
            appSubscriptionCreate(
                name: $name,
                returnUrl: $returnUrl,
                trialDays: $trialDays,
                test: $test,
                lineItems: $lineItems
            ) {
                appSubscription {
                    id
                }
                confirmationUrl
                userErrors {
                    field
                    message
                }
            }
        }

 

 [
  "name" => "Advanced"
  "returnUrl" => "https://sa-app.local.com/billing/process/2"
  "trialDays" => 7
  "test" => true
  "lineItems" => [
    [
      "plan" => [
        "appRecurringPricingDetails" => [
          "price" => [
            "amount" => 19.99
            "currencyCode" => "USD"
          ]
          "interval" => "ANNUAL"
        ]
      ]
    ]
  ]
]



0 Likes
naumanbashir
New Member
3 1 0

This is an accepted solution.

Ah, my bad. I was using the older version of the API (2020-01) whereas, ANNUAL subscription is available since API (2020-10) version on wards.

0 Likes