How to get subscription type for oneTimePurchases in currentAppInstallation???

How to get subscription type for oneTimePurchases in currentAppInstallation???

Oolong2k
Shopify Partner
2 0 0

1. I have successfully registered for One time purchase and subscriptions. After receiving the confirmationUrl, I clicked Approve. However, when I use the currentAppInstallation API to get the subscription type, including oneTimePurchases, I do not receive any results.
2. How can I know whether the subscription has been saved to Shopify when using APP_PURCHASES_ONE_TIME_UPDATE or APP_SUBSCRIPTIONS_UPDATE?
confirmationUrl (image):

Oolong2k_0-1704758400664.png

mutation {
        webhookSubscriptionCreate(
          topic: APP_SUBSCRIPTIONS_UPDATE
          webhookSubscription: {
            callbackUrl: "https://maker.ifttt.com/trigger/S_UPDATE/json/with/key/cdhdhsgwywKHij3S",
            format: JSON
          }
        ) {
          userErrors {
            field
            message
          }
          webhookSubscription {
            id
          }
        }
      }
export const getSubscribedTypes = async (session: Session) => {
  const client = await getGraphqlClient(session);
  const response = await client.query<CurrentAppInstallations>({
    data: `
      query {
        currentAppInstallation {
          oneTimePurchases(first: 0) {
            edges {
              node {
                name
                status
              }
            }
          }
        }
      }
    `,
  });

  console.log("response", response.body.data.currentAppInstallation.oneTimePurchases.edges);
  return response.body.data.currentAppInstallation.oneTimePurchases.edges.map(
    ({ node }) => {
      const { name } = node;
      console.log("node", name, node);
      return SUBSCRIPTION_TYPES.find(
        (type) => name.toLowerCase().indexOf(type) >= 0
      );
    }
  );
};

Thank you for help me!

Replies 0 (0)