Getting "Custom apps cannot use the Billing API" on Public app

I created a test public app to work on creating/managing subscriptions.
When I try to create a new subscriptions I have the following error:

Error: AppError: Error while creating app billing plan: [{“field”:null,“message”:“Custom apps cannot use the Billing API”}]

I am obviously using the function in a public app and not a custom one and testing it using shopify app dev.

Here is the code for reference:

  const oResult = await oGraphQlClient.request(ShopifyApiOperations.AppSubscriptionCreateMutation, {

      name: "TestApp Subscription",

returnUrl,

      test: true,

      lineItems: [

// Create the recurring pricing line item for the plan.

        {

          plan: {

            appRecurringPricingDetails: recurringPricingDetails,

          },

        },

// Create one line item for each of the usage 

...usagePricingDetails.map((usageDetails) => ({

          plan: {

            appUsagePricingDetails: usageDetails,

          },

        })),

      ],

    });

Any idea why this error occurs?

have you set your app distribution public in your app partner dashboard?