createEntitiesStep - Helper Steps API Reference

This documentation provides a reference to the createEntitiesStep step. It belongs to the @medusajs/medusa/core-flows package.

This step creates one or more entities using methods in a module's service.

Example#

Code
1createEntitiesStep({2  moduleRegistrationName: Modules.CART,3  invokeMethod: "createCreditLines",4  compensateMethod: "deleteCreditLines",5  data: {6    cart_id: "cart_123",7    amount: 10,8    reference: "payment",9    reference_id: "payment_123",10    metadata: {11      key: "value",12    },13  },14})

Input#

CreateEntitiesStepTypeCreateEntitiesStepType
moduleRegistrationNamestring
The regitration name of the module that contains the method to be invoked.
invokeMethodstring
The method to be invoked.
compensateMethodstring
The method to be invoked in case of compensation (when an error occurs).
dataany[]
The data to pass to the invoke method. For example, an array of objects to create.
entityIdentifierstringOptional
A string to pass to the compensate method.

Output#

any[]any[]
anyany
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break