How to handle free plan for an app

linkadoo
New Member
1 0 0

Hi,

Currently I'm developing a Shopify app with two plans: Free Plan and a paid plan. 

The default plan will be free and there will be various limitations for the free plan. Therefore I need to keep track of the subscription start and end dates (in order to calculate the actions taken by the merchant between those dates). I am trying to create a free subscription plan with the following graphQL mutation.

 

 

const variables =
    {
        "lineItems": {
            "plan": {
                "appRecurringPricingDetails": {
                    "price": {
                        "amount": "0",
                        "currencyCode": "USD"
                    },
                    "interval": "EVERY_30_DAYS"
                },
            }
        },
        "name": "Free Subscription Plan",
        "returnUrl": "myreturnURL",
        "test": true,
    }

    const query = `
        mutation appSubscriptionCreate($lineItems: [AppSubscriptionLineItemInput!]!, $name: String!, $returnUrl: URL!, $test: Boolean) {
            appSubscriptionCreate(lineItems: $lineItems, name: $name, returnUrl: $returnUrl, test: $test) {
              userErrors {
                field
                message
              }
              appSubscription {
                createdAt
                id
                name
                lineItems{
                    id
                    plan{
                        pricingDetails
                    }
                }
                returnUrl
                status
                currentPeriodEnd
              }
              confirmationUrl
            }
          }
        `

 

 

Yet I get the following response. 

"message": "Validation failed: Price must be greater than zero"
 
My question is: How can I create a free subscription so that I can track user activity between the start and end dates of each subscription period.
Replies 0 (0)