Dynamic Zone Creation Issue in Custom Plugin for Strapi v4

I’m currently working on a custom plugin for Strapi v4, and I’m trying to incorporate a Dynamic Zone within it. However, I’ve run into a roadblock and could really use some insights.

In my plugin, I have a content type with several fields, one of them is supposed to be a Dynamic Zone with the name “paymentType”. Here’s how I defined it:

{
  ...
  "attributes": {
    "name": {
      "type": "string"
    },
    ...
    "paymentType": {
      "type": "dynamiczone",
      "components": ["payment-type"]
    }
  }
}

In addition, I’ve defined a component called “payment-type” in the plugins/myplugin/components directory of my Strapi project. It’s pretty straightforward with just two fields:

{
  "collectionName": "plugins_myplugin_components_payment_type",
  "info": {
    "displayName": "payment-type",
    "icon": "bulletList"
  },
  "options": {},
  "attributes": {
    "name": {
      "type": "string"
    },
    "description": {
      "type": "richtext"
    }
  }
}

Despite this, I keep encountering an error whenever I try to run Strapi: ApplicationError: Trying to create a dynamic zone type with an unknown component: “payment-type”.

I’ve already attempted using the double-colon syntax (“myplugin::payment-type”) and the dot syntax (“application::payment-type”), but both ways still result in the same error.

I’ve been pouring over the documentation and checking my code for any inconsistencies, but I’m stuck and can’t seem to figure out where I’m going wrong.

Has anyone else experienced this issue and found a way around it? Any guidance or suggestions would be greatly appreciated!

Thanks in advance for any help you’re able to provide.

System Information
  • Strapi Version: 4.11.4
  • Operating System: Ubuntu 23.04
  • Database: mysql:8.0
  • Node Version: 18.16.1
  • Yarn Version: 1.22.19