Version: 2024-04
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) { appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) { userErrors { field message } appSubscription { id } confirmationUrl } }\",\n \"variables\": {\n \"name\": \"Super Duper Recurring Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n },\n \"interval\": \"EVERY_30_DAYS\"\n }\n }\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n }`,\n \"variables\": {\n \"name\": \"Super Duper Recurring Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n },\n \"interval\": \"EVERY_30_DAYS\"\n }\n }\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n }\nQUERY\n\nvariables = {\n \"name\": \"Super Duper Recurring Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>10.0, \"currencyCode\"=>\"USD\"}, \"interval\"=>\"EVERY_30_DAYS\"}}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<\"Super Duper Recurring Plan\",\n \"returnUrl\" => \"http://super-duper.shopifyapps.com/\",\n \"lineItems\" => [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>10.0, \"currencyCode\"=>\"USD\"}, \"interval\"=>\"EVERY_30_DAYS\"}}}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n }`,\n {\n variables: {\n \"name\": \"Super Duper Recurring Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n },\n \"interval\": \"EVERY_30_DAYS\"\n }\n }\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n}"
input: { "name": "Super Duper Recurring Plan", "returnUrl": "http://super-duper.shopifyapps.com/", "lineItems": [ { "plan": { "appRecurringPricingDetails": { "price": { "amount": 10.0, "currencyCode": "USD" }, "interval": "EVERY_30_DAYS" } } } ] }
response: { "data": { "appSubscriptionCreate": { "userErrors": [], "appSubscription": { "id": "gid://shopify/AppSubscription/1029266950" }, "confirmationUrl": "https://billingshop.myshopify.com/admin/charges/166357/1029266950/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAZeWT06EmF1dG9fYWN0aXZhdGVU--353b847ab561a829e9db3d95f0ff5a23a4f690be" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) { appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) { userErrors { field message } appSubscription { id lineItems { id plan { pricingDetails __typename } } } confirmationUrl } }\",\n \"variables\": {\n \"name\": \"Super Duper Usage Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appUsagePricingDetails\": {\n \"terms\": \"$1 for 100 emails\",\n \"cappedAmount\": {\n \"amount\": 20.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n lineItems {\n id\n plan {\n pricingDetails\n __typename\n }\n }\n }\n confirmationUrl\n }\n }`,\n \"variables\": {\n \"name\": \"Super Duper Usage Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appUsagePricingDetails\": {\n \"terms\": \"$1 for 100 emails\",\n \"cappedAmount\": {\n \"amount\": 20.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n lineItems {\n id\n plan {\n pricingDetails\n __typename\n }\n }\n }\n confirmationUrl\n }\n }\nQUERY\n\nvariables = {\n \"name\": \"Super Duper Usage Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [{\"plan\"=>{\"appUsagePricingDetails\"=>{\"terms\"=>\"$1 for 100 emails\", \"cappedAmount\"=>{\"amount\"=>20.0, \"currencyCode\"=>\"USD\"}}}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<\"Super Duper Usage Plan\",\n \"returnUrl\" => \"http://super-duper.shopifyapps.com/\",\n \"lineItems\" => [{\"plan\"=>{\"appUsagePricingDetails\"=>{\"terms\"=>\"$1 for 100 emails\", \"cappedAmount\"=>{\"amount\"=>20.0, \"currencyCode\"=>\"USD\"}}}}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n lineItems {\n id\n plan {\n pricingDetails\n __typename\n }\n }\n }\n confirmationUrl\n }\n }`,\n {\n variables: {\n \"name\": \"Super Duper Usage Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appUsagePricingDetails\": {\n \"terms\": \"$1 for 100 emails\",\n \"cappedAmount\": {\n \"amount\": 20.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n lineItems {\n id\n plan {\n pricingDetails\n __typename\n }\n }\n }\n confirmationUrl\n }\n}"
input: { "name": "Super Duper Usage Plan", "returnUrl": "http://super-duper.shopifyapps.com/", "lineItems": [ { "plan": { "appUsagePricingDetails": { "terms": "$1 for 100 emails", "cappedAmount": { "amount": 20.0, "currencyCode": "USD" } } } } ] }
response: { "data": { "appSubscriptionCreate": { "userErrors": [], "appSubscription": { "id": "gid://shopify/AppSubscription/1029266949", "lineItems": [ { "id": "gid://shopify/AppSubscriptionLineItem/1029266949?v=1&index=0", "plan": { "pricingDetails": {}, "__typename": "AppPlanV2" } } ] }, "confirmationUrl": "https://billingshop.myshopify.com/admin/charges/166357/1029266949/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAVeWT06EmF1dG9fYWN0aXZhdGVU--0f11019bf0fe7edcdb89347c432a14109c53f618" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) { appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) { userErrors { field message } appSubscription { id } confirmationUrl } }\",\n \"variables\": {\n \"name\": \"Super Duper Recurring Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n },\n \"interval\": \"ANNUAL\"\n }\n }\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n }`,\n \"variables\": {\n \"name\": \"Super Duper Recurring Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n },\n \"interval\": \"ANNUAL\"\n }\n }\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n }\nQUERY\n\nvariables = {\n \"name\": \"Super Duper Recurring Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>10.0, \"currencyCode\"=>\"USD\"}, \"interval\"=>\"ANNUAL\"}}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<\"Super Duper Recurring Plan\",\n \"returnUrl\" => \"http://super-duper.shopifyapps.com/\",\n \"lineItems\" => [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>10.0, \"currencyCode\"=>\"USD\"}, \"interval\"=>\"ANNUAL\"}}}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n }`,\n {\n variables: {\n \"name\": \"Super Duper Recurring Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n },\n \"interval\": \"ANNUAL\"\n }\n }\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n}"
input: { "name": "Super Duper Recurring Plan", "returnUrl": "http://super-duper.shopifyapps.com/", "lineItems": [ { "plan": { "appRecurringPricingDetails": { "price": { "amount": 10.0, "currencyCode": "USD" }, "interval": "ANNUAL" } } } ] }
response: { "data": { "appSubscriptionCreate": { "userErrors": [], "appSubscription": { "id": "gid://shopify/AppSubscription/1029266947" }, "confirmationUrl": "https://billingshop.myshopify.com/admin/charges/166357/1029266947/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBANeWT06EmF1dG9fYWN0aXZhdGVU--f6a58f222ad78948c56c070cc490ecf8dbb7048c" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) { appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) { userErrors { field message } appSubscription { id lineItems { id plan { pricingDetails { __typename } } } } confirmationUrl } }\",\n \"variables\": {\n \"name\": \"Super Duper Recurring and Usage Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appUsagePricingDetails\": {\n \"terms\": \"$1 for 100 emails\",\n \"cappedAmount\": {\n \"amount\": 20.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n },\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n lineItems {\n id\n plan {\n pricingDetails {\n __typename\n }\n }\n }\n }\n confirmationUrl\n }\n }`,\n \"variables\": {\n \"name\": \"Super Duper Recurring and Usage Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appUsagePricingDetails\": {\n \"terms\": \"$1 for 100 emails\",\n \"cappedAmount\": {\n \"amount\": 20.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n },\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n lineItems {\n id\n plan {\n pricingDetails {\n __typename\n }\n }\n }\n }\n confirmationUrl\n }\n }\nQUERY\n\nvariables = {\n \"name\": \"Super Duper Recurring and Usage Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [{\"plan\"=>{\"appUsagePricingDetails\"=>{\"terms\"=>\"$1 for 100 emails\", \"cappedAmount\"=>{\"amount\"=>20.0, \"currencyCode\"=>\"USD\"}}}}, {\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>10.0, \"currencyCode\"=>\"USD\"}}}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<\"Super Duper Recurring and Usage Plan\",\n \"returnUrl\" => \"http://super-duper.shopifyapps.com/\",\n \"lineItems\" => [{\"plan\"=>{\"appUsagePricingDetails\"=>{\"terms\"=>\"$1 for 100 emails\", \"cappedAmount\"=>{\"amount\"=>20.0, \"currencyCode\"=>\"USD\"}}}}, {\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>10.0, \"currencyCode\"=>\"USD\"}}}}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n lineItems {\n id\n plan {\n pricingDetails {\n __typename\n }\n }\n }\n }\n confirmationUrl\n }\n }`,\n {\n variables: {\n \"name\": \"Super Duper Recurring and Usage Plan\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appUsagePricingDetails\": {\n \"terms\": \"$1 for 100 emails\",\n \"cappedAmount\": {\n \"amount\": 20.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n },\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n lineItems {\n id\n plan {\n pricingDetails {\n __typename\n }\n }\n }\n }\n confirmationUrl\n }\n}"
input: { "name": "Super Duper Recurring and Usage Plan", "returnUrl": "http://super-duper.shopifyapps.com/", "lineItems": [ { "plan": { "appUsagePricingDetails": { "terms": "$1 for 100 emails", "cappedAmount": { "amount": 20.0, "currencyCode": "USD" } } } }, { "plan": { "appRecurringPricingDetails": { "price": { "amount": 10.0, "currencyCode": "USD" } } } } ] }
response: { "data": { "appSubscriptionCreate": { "userErrors": [], "appSubscription": { "id": "gid://shopify/AppSubscription/1029266953", "lineItems": [ { "id": "gid://shopify/AppSubscriptionLineItem/1029266953?v=1&index=0", "plan": { "pricingDetails": { "__typename": "AppRecurringPricing" } } }, { "id": "gid://shopify/AppSubscriptionLineItem/1029266953?v=1&index=1", "plan": { "pricingDetails": { "__typename": "AppUsagePricing" } } } ] }, "confirmationUrl": "https://billingshop.myshopify.com/admin/charges/166357/1029266953/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAleWT06EmF1dG9fYWN0aXZhdGVU--4314ad97c411fa9da47834a7893463df148d23f1" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) { appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) { userErrors { field message } confirmationUrl appSubscription { id } } }\",\n \"variables\": {\n \"name\": \"30 Day Recurring Plan\",\n \"returnUrl\": \"https://review-app.shopifyapps.com\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"discount\": {\n \"value\": {\n \"amount\": 5.0\n },\n \"durationLimitInIntervals\": 2\n },\n \"interval\": \"EVERY_30_DAYS\"\n }\n }\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n }`,\n \"variables\": {\n \"name\": \"30 Day Recurring Plan\",\n \"returnUrl\": \"https://review-app.shopifyapps.com\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"discount\": {\n \"value\": {\n \"amount\": 5.0\n },\n \"durationLimitInIntervals\": 2\n },\n \"interval\": \"EVERY_30_DAYS\"\n }\n }\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n }\nQUERY\n\nvariables = {\n \"name\": \"30 Day Recurring Plan\",\n \"returnUrl\": \"https://review-app.shopifyapps.com\",\n \"lineItems\": [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>40.0, \"currencyCode\"=>\"USD\"}, \"discount\"=>{\"value\"=>{\"amount\"=>5.0}, \"durationLimitInIntervals\"=>2}, \"interval\"=>\"EVERY_30_DAYS\"}}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<\"30 Day Recurring Plan\",\n \"returnUrl\" => \"https://review-app.shopifyapps.com\",\n \"lineItems\" => [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>40.0, \"currencyCode\"=>\"USD\"}, \"discount\"=>{\"value\"=>{\"amount\"=>5.0}, \"durationLimitInIntervals\"=>2}, \"interval\"=>\"EVERY_30_DAYS\"}}}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n }`,\n {\n variables: {\n \"name\": \"30 Day Recurring Plan\",\n \"returnUrl\": \"https://review-app.shopifyapps.com\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"discount\": {\n \"value\": {\n \"amount\": 5.0\n },\n \"durationLimitInIntervals\": 2\n },\n \"interval\": \"EVERY_30_DAYS\"\n }\n }\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n}"
input: { "name": "30 Day Recurring Plan", "returnUrl": "https://review-app.shopifyapps.com", "lineItems": [ { "plan": { "appRecurringPricingDetails": { "price": { "amount": 40.0, "currencyCode": "USD" }, "discount": { "value": { "amount": 5.0 }, "durationLimitInIntervals": 2 }, "interval": "EVERY_30_DAYS" } } } ] }
response: { "data": { "appSubscriptionCreate": { "userErrors": [], "confirmationUrl": "https://billingshop.myshopify.com/admin/charges/166357/1029266948/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAReWT06EmF1dG9fYWN0aXZhdGVU--ca2d9875a571449437b370eb58ed91e535a67e43", "appSubscription": { "id": "gid://shopify/AppSubscription/1029266948" } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!, $trialDays: Int) { appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems, trialDays: $trialDays) { userErrors { field message } appSubscription { id } confirmationUrl } }\",\n \"variables\": {\n \"name\": \"Super Duper Recurring Plan with a Trial\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"trialDays\": 7,\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!, $trialDays: Int) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems, trialDays: $trialDays) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n }`,\n \"variables\": {\n \"name\": \"Super Duper Recurring Plan with a Trial\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"trialDays\": 7,\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!, $trialDays: Int) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems, trialDays: $trialDays) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n }\nQUERY\n\nvariables = {\n \"name\": \"Super Duper Recurring Plan with a Trial\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"trialDays\": 7,\n \"lineItems\": [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>10.0, \"currencyCode\"=>\"USD\"}}}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<\"Super Duper Recurring Plan with a Trial\",\n \"returnUrl\" => \"http://super-duper.shopifyapps.com/\",\n \"trialDays\" => 7,\n \"lineItems\" => [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>10.0, \"currencyCode\"=>\"USD\"}}}}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!, $trialDays: Int) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems, trialDays: $trialDays) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n }`,\n {\n variables: {\n \"name\": \"Super Duper Recurring Plan with a Trial\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n \"trialDays\": 7,\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 10.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!, $trialDays: Int) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems, trialDays: $trialDays) {\n userErrors {\n field\n message\n }\n appSubscription {\n id\n }\n confirmationUrl\n }\n}"
input: { "name": "Super Duper Recurring Plan with a Trial", "returnUrl": "http://super-duper.shopifyapps.com/", "trialDays": 7, "lineItems": [ { "plan": { "appRecurringPricingDetails": { "price": { "amount": 10.0, "currencyCode": "USD" } } } } ] }
response: { "data": { "appSubscriptionCreate": { "userErrors": [], "appSubscription": { "id": "gid://shopify/AppSubscription/1029266952" }, "confirmationUrl": "https://billingshop.myshopify.com/admin/charges/166357/1029266952/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAheWT06EmF1dG9fYWN0aXZhdGVU--427058b56d1c8ee21519d6d84fe79589400563c9" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) { appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) { userErrors { field message } confirmationUrl appSubscription { id } } }\",\n \"variables\": {\n \"name\": \"30 Day Recurring Plan\",\n \"returnUrl\": \"https://review-app.shopifyapps.com\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"discount\": {\n \"value\": {\n \"percentage\": 0.2\n },\n \"durationLimitInIntervals\": 10\n },\n \"interval\": \"EVERY_30_DAYS\"\n }\n }\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n }`,\n \"variables\": {\n \"name\": \"30 Day Recurring Plan\",\n \"returnUrl\": \"https://review-app.shopifyapps.com\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"discount\": {\n \"value\": {\n \"percentage\": 0.2\n },\n \"durationLimitInIntervals\": 10\n },\n \"interval\": \"EVERY_30_DAYS\"\n }\n }\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n }\nQUERY\n\nvariables = {\n \"name\": \"30 Day Recurring Plan\",\n \"returnUrl\": \"https://review-app.shopifyapps.com\",\n \"lineItems\": [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>40.0, \"currencyCode\"=>\"USD\"}, \"discount\"=>{\"value\"=>{\"percentage\"=>0.2}, \"durationLimitInIntervals\"=>10}, \"interval\"=>\"EVERY_30_DAYS\"}}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<\"30 Day Recurring Plan\",\n \"returnUrl\" => \"https://review-app.shopifyapps.com\",\n \"lineItems\" => [{\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>40.0, \"currencyCode\"=>\"USD\"}, \"discount\"=>{\"value\"=>{\"percentage\"=>0.2}, \"durationLimitInIntervals\"=>10}, \"interval\"=>\"EVERY_30_DAYS\"}}}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n }`,\n {\n variables: {\n \"name\": \"30 Day Recurring Plan\",\n \"returnUrl\": \"https://review-app.shopifyapps.com\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"discount\": {\n \"value\": {\n \"percentage\": 0.2\n },\n \"durationLimitInIntervals\": 10\n },\n \"interval\": \"EVERY_30_DAYS\"\n }\n }\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n}"
input: { "name": "30 Day Recurring Plan", "returnUrl": "https://review-app.shopifyapps.com", "lineItems": [ { "plan": { "appRecurringPricingDetails": { "price": { "amount": 40.0, "currencyCode": "USD" }, "discount": { "value": { "percentage": 0.2 }, "durationLimitInIntervals": 10 }, "interval": "EVERY_30_DAYS" } } } ] }
response: { "data": { "appSubscriptionCreate": { "userErrors": [], "confirmationUrl": "https://billingshop.myshopify.com/admin/charges/166357/1029266951/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAdeWT06EmF1dG9fYWN0aXZhdGVU--97200e8aec46abce1cc3737c2e286e892edeb3e1", "appSubscription": { "id": "gid://shopify/AppSubscription/1029266951" } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) { appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) { userErrors { field message } confirmationUrl appSubscription { id } } }\",\n \"variables\": {\n \"name\": \"Subscription for Module A and Module B\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appUsagePricingDetails\": {\n \"terms\": \"$1 for 100 emails for Module B\",\n \"cappedAmount\": {\n \"amount\": 20.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n },\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 35.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n }`,\n \"variables\": {\n \"name\": \"Subscription for Module A and Module B\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appUsagePricingDetails\": {\n \"terms\": \"$1 for 100 emails for Module B\",\n \"cappedAmount\": {\n \"amount\": 20.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n },\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 35.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n }\nQUERY\n\nvariables = {\n \"name\": \"Subscription for Module A and Module B\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com\",\n \"lineItems\": [{\"plan\"=>{\"appUsagePricingDetails\"=>{\"terms\"=>\"$1 for 100 emails for Module B\", \"cappedAmount\"=>{\"amount\"=>20.0, \"currencyCode\"=>\"USD\"}}}}, {\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>35.0, \"currencyCode\"=>\"USD\"}}}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<\"Subscription for Module A and Module B\",\n \"returnUrl\" => \"http://super-duper.shopifyapps.com\",\n \"lineItems\" => [{\"plan\"=>{\"appUsagePricingDetails\"=>{\"terms\"=>\"$1 for 100 emails for Module B\", \"cappedAmount\"=>{\"amount\"=>20.0, \"currencyCode\"=>\"USD\"}}}}, {\"plan\"=>{\"appRecurringPricingDetails\"=>{\"price\"=>{\"amount\"=>35.0, \"currencyCode\"=>\"USD\"}}}}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n }`,\n {\n variables: {\n \"name\": \"Subscription for Module A and Module B\",\n \"returnUrl\": \"http://super-duper.shopifyapps.com\",\n \"lineItems\": [\n {\n \"plan\": {\n \"appUsagePricingDetails\": {\n \"terms\": \"$1 for 100 emails for Module B\",\n \"cappedAmount\": {\n \"amount\": 20.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n },\n {\n \"plan\": {\n \"appRecurringPricingDetails\": {\n \"price\": {\n \"amount\": 35.0,\n \"currencyCode\": \"USD\"\n }\n }\n }\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) {\n appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems) {\n userErrors {\n field\n message\n }\n confirmationUrl\n appSubscription {\n id\n }\n }\n}"
input: { "name": "Subscription for Module A and Module B", "returnUrl": "http://super-duper.shopifyapps.com", "lineItems": [ { "plan": { "appUsagePricingDetails": { "terms": "$1 for 100 emails for Module B", "cappedAmount": { "amount": 20.0, "currencyCode": "USD" } } } }, { "plan": { "appRecurringPricingDetails": { "price": { "amount": 35.0, "currencyCode": "USD" } } } } ] }
response: { "data": { "appSubscriptionCreate": { "userErrors": [], "confirmationUrl": "https://billingshop.myshopify.com/admin/charges/166357/1029266954/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBApeWT06EmF1dG9fYWN0aXZhdGVU--8502272f2d30cfc1b77e3f1521764c17c11f003b", "appSubscription": { "id": "gid://shopify/AppSubscription/1029266954" } } } }