Hi,
I'm using appSubscriptionCreate on my index page to get the confirmation_url. But the data return is undefined.
Query:
mutation appSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!) { appSubscriptionCreate(name: $name, lineItems: $lineItems, returnUrl: $returnUrl) { appSubscription { id } confirmationUrl userErrors { field message } } }
Index:
const {error:ee, data:dd} = useMutation(CREATE_RECURRING, { variables:{ name: "Recurring", lineItems: [{ plan: { appRecurringPricingDetails: { price: { amount: 9.95, currencyCode: 'USD' } } } }], returnUrl: "https://app.magicupsell.com", trialDays: 14, test: true, } });
console.log(dd) always get "undefined". Anyone have clue?
Hey @Amar_Gandhi,
Can you please provide a request ID? Are you able to send the request outside of the library?
Having the same issue, I have been running the app with no problem for the last month. Then yesterday I experienced this appSubscriptionCreate of undefined. I seems that the appSubscriptionCreate mutation request is coming back undefined.
Here is the code snippet:
const getSubscriptionUrl = async (ctx, accessToken, shop) => { const ENDPOINT = `https://${shop}/admin/api/2020-04/graphql.json`; const query = JSON.stringify({ query: `mutation { appSubscriptionCreate( name: "xxx" returnUrl: "${process.env.HOST}" test: true lineItems: [ { plan: { appUsagePricingDetails: { cappedAmount: { amount: 10000, currencyCode: USD } terms: "$0.65 for every order shipped" } } } { plan: { appRecurringPricingDetails: { price: { amount: 0, currencyCode: USD } } } } ] ) { userErrors { field message } confirmationUrl appSubscription { id } } }` }); const response = await fetch(ENDPOINT, { method: "POST", headers: { "Content-Type": "application/json", "X-Shopify-Access-Token": accessToken }, body: query }); const responseJson = await response.json(); const confirmationUrl = responseJson.data.appSubscriptionCreate.confirmationUrl;
Please help
@Markus95 can you please provide a request ID from the response headers? Are you able to send the request outside of the library?
@SBD_ Here are 2 request IDs:
90e1d9a1-f067-4486-82b3-d77079a2909d
1130dc00-3715-4d13-bcbb-b298923516a9
Here is the error I am getting with the requestId:
{ errors:
[ { message:
'Internal error. Looks like something went wrong on our end.\nRequest ID: b4f1e186-0c87-4e4c-bfd3-296db73be25d (include this in support requests).',
extensions:
{ code: 'INTERNAL_SERVER_ERROR',
requestId: 'b4f1e186-0c87-4e4c-bfd3-296db73be25d' } } ] }
{ e:
TypeError: Cannot read property 'appSubscriptionCreate' of undefined
@Markus95 it appears this is caused by the app using online access tokens to create billing requests. Apps will need to use offline access tokens to do this. Let me know if this resolves the issue.
SBD_
I'm having the same issue and getting the following error:
{
"errors": [
{
"message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 2718c84c-96f7-448f-8fb5-b7787977c731 (include this in support requests).",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"requestId": "2718c84c-96f7-448f-8fb5-b7787977c731"
}
}
]
}
I get the same error even when sending the request through postman.
User | Count |
---|---|
13 | |
12 | |
7 | |
6 | |
5 |