Hello! We develop a public app and create recurring charges using graphql:
appSubscriptionCreate mutation
https://shopify.dev/api/admin-graphql/2022-10/mutations/appsubscriptioncreate
we set ‘test’ to True but the generated link requires credit card details and refuses the transaction.
We are testing on a development store. How can we simulate transaction and trigger an APP_SUBSCRIPTIONS_UPDATE event.
THANK YOU!
vanley
2
Have the same issue!
fields:
test, trialDays
Looks like both of them are ignored on appSubscriptionCreate mutation, which looks like a bug!
Example:
Request:
GRAPHQL {{shopify_API_shop_admin_domain}}{{shopify_API_version}}{{shopify_API_graphQL_entrypoint}}
Content-Type: application/json
X-Shopify-Access-Token: {{shopify-access-token}}
mutation appSubscriptionCreate($lineItems: [AppSubscriptionLineItemInput!]!, $name: String!, $returnUrl: URL!) {
appSubscriptionCreate(lineItems: $lineItems, name: $name, returnUrl: $returnUrl) {
appSubscription {
id
name
test
trialDays
returnUrl
}
confirmationUrl
userErrors {
field
message
}
}
}
{
"test": true,
"trialDays": 14,
"lineItems": {
"plan": {
"appRecurringPricingDetails": {
"interval": "EVERY_30_DAYS",
"price": {
"amount": 8.00,
"currencyCode": "USD"
}
}
}
},
"name": "MY AWESOME PLAN",
"returnUrl": "https://shop-domain.myshopify.com/admin/apps/my-app"
}
Response:
{
"data": {
"appSubscriptionCreate": {
"appSubscription": {
"id": "gid:\/\/shopify\/AppSubscription\/25893175455",
"name": "MY AWESOME PLAN",
"test": false,
"trialDays": 0,
"returnUrl": "https:\/\/shop-domain.myshopify.com\/admin\/apps\/my-app"
},
"confirmationUrl": "https:\/\/theoptishop.myshopify.com\/admin\/charges\/6702869\/25893175455\/RecurringApplicationCharge\/confirm_recurring_application_charge?signature=BAh7BzoHaWRsKwifgFoHBgA6EmF1dG9fYWN0aXZhdGVU--24baf5d062ada47f14da4d1c1d161bc0803c5a9b",
"userErrors": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
vanley
3
@annawonder
make sure that you are adding proper mutation description
this is fixing my issue:
mutation appSubscriptionCreate($test: Boolean, $trialDays: Int, $lineItems: [AppSubscriptionLineItemInput!]!, $name: String!, $returnUrl: URL!) {
appSubscriptionCreate(test: $test, trialDays: $trialDays, lineItems: $lineItems, name: $name, returnUrl: $returnUrl) {
appSubscription {
id
name
test
trialDays
returnUrl
}
confirmationUrl
userErrors {
field
message
}
}
}
{
"lineItems": {
"plan": {
"appRecurringPricingDetails": {
"discount": {
"durationLimitInIntervals": 3,
"value": {
"amount": 3.00
}
},
"interval": "EVERY_30_DAYS",
"price": {
"amount": 9.00,
"currencyCode": "USD"
}
}
}
},
"name": "MY AWESOME PLAN 2",
"replacementBehavior": "APPLY_IMMEDIATELY",
"returnUrl": "http://super-duper.shopifyapps.com/",
"test": true,
"trialDays": 14
}