Hi I am new to shopify .
Please help me on this how I can receive the payment status.
I am calling below graphql for payment page
const getSubscriptionUrl = async (ctx, accessToken, shop) => {
console.log(accessToken);
const query = JSON.stringify({
query: mutation { appSubscriptionCreate( name: "Super Duper Plan" returnUrl: "${process.env.HOST}" test: true lineItems: [ { plan: { appUsagePricingDetails: { cappedAmount: { amount: 5, currencyCode: USD } terms: "$1 for 1000 emails" } } } { plan: { appRecurringPricingDetails: { price: { amount: 5, currencyCode: USD } } } } ] ) { userErrors { field message } confirmationUrl appSubscription { id } } }
});
const response = await fetch(https://${shop}/admin/api/2019-07/graphql.json, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
“X-Shopify-Access-Token”: accessToken,
},
body: query
})
const responseJson = await response.json();
console.log(‘responseJson’,responseJson);
const confirmationUrl = responseJson.data.appSubscriptionCreate.confirmationUrl
return ctx.redirect(confirmationUrl)
};
module.exports = getSubscriptionUrl;