medusa js custom payment plugin can not test locally

241 Views Asked by At

I am trying to develop a custom plugin for adding custom payment provider. I follow the instructions from the docs https://docs.medusajs.com/development/plugins/publish but when I try to test plugin in local machine using npm link it dose not work and I can not test my plugin. how can I fix it. please help me

I also test, medusa-payment-stripe from medusa plugin market https://medusajs.com/plugins/medusa-payment-stripe/ using npm install medusa-payment-stripe, it work properly but when I copy the stripe plugin code from the medusa core to check is it work locally then I found it does not work locally.

I also , added provider_id manually in database at payment_provider table but it give me following error

{ "type": "not_found", "message": "Could not find a payment provider with id: stripe" }


1

There are 1 best solutions below

0
On

when you run your backend you should preserve symlinks for your backend to start with the linked pluging you can acheave that by this command :

npm run dev --  -- --preserve-symlinks

or you can add it to your package.json scripts:

"dev:link": "cross-env npm run dev --  -- --preserve-symlinks"

and run it with :

yarn dev:link

Note: dont forget to add your plugin to your medusa-config.js