When I try to request a link to charge my app to the user it throws me this error:
userErrors: [
{
field: null,
message: 'Managed Pricing Apps cannot use the Billing API (to create charges).'
}
],
This is my query:
const response = await admin.graphql(
`#graphql
mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!, $trialDays: Int, $test: Boolean) {
appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems, trialDays: $trialDays, test: $test) {
userErrors {
field
message
}
appSubscription {
id
}
confirmationUrl
}
}`,
{
variables: {
"name": "APP PROVA",
"returnUrl": `https://admin.shopify.com/store/${session.shop.replace('.myshopify.com', '')}`,
"trialDays": 14,
"test": true,
"lineItems": [
{
"plan": {
"appUsagePricingDetails": {
"cappedAmount": {
"amount": 5.99,
"currencyCode": "USD"
},
"terms": "Terms info"
}
}
}
]
},
},
);