Category

Payment

Version

0.1.48

Last updated

Jan 18, 2024, 08:50:13 AMa year ago

Medusa.js PayU plugin

This plugin allows you to use PayU service as a payment provider in MedusaJS

Note: this plugin is made strictly for a marketplace implementation

Installation

1. To start working with the plugin you should have the following:
2. Run the following command in the directory of your Medusa server
npm install medusa-plugin-payu
or
yarn add medusa-plugin-payu
3. In Copy to clipboardmedusa-config.js file add the following to the Copy to clipboardplugins array:
const plugins = [
// ...
{
resolve: `medusa-plugin-payu`,
options: {
url: process.env.PAYU_URL,
access_token: process.env.PAYU_ACCESS_TOKEN,
posId: process.env.PAYU_POS_ID,
currency: process.env.PAYU_CURRENCY,
clientId: process.env.PAYU_CLIENT_ID,
clientSecret: process.env.PAYU_CLIENT_SECRET,
serverUrl: process.env.URL,
serverIp: process.env.SERVER_IP,
},
},
// ...
];

Parameters:

  • url - required, an domain that all payu request should be sent to, for sandbox it should be: https://secure.snd.payu.com
  • access_token - required, obtained from your PayU account
  • posId - required, obtained from your PayU account
  • currency - required
  • clientId - required, obtained from your PayU account
  • clientSecret - required, obtained from your PayU account
  • serverUrl - required, url address of your medusa server
  • serverIp - required, IP address of your server
4. Usage
To list all available payment methods send GET request to the following endpoint:
https://your-medusa-backend-url.com/payu/payment-methods
You should enable PayU payment provider in you medusa region, the identifier to use while creating payment sessions for your cart is 'payu'.
For the plugin to work correctly your cart's metadata should contain the following records:
  • phone - phone number of the customer,
  • first_name - first name of the customer,
  • last_name - last name of the customer,
  • payMethods - not required, if not present the user will be redirect to payu panel instead of given payment method.
payMethods should be an object with following structure:
payMethods: {
payMethod: {
type: string; // should be 'PBL' in most cases, based on payment method
value: string; // id of choosen payment method
}
}

Disclaimer

Features like full refund, partial refund, update payment data or payment cancel/delete are either not implemented or might not work correctly. The plugin might contain bugs, if you encounter any please report them to: hello@rigby.pl

Build your own plugins

Develop your own plugins with our API to speed up your processes.

Make your plugin available via npm for it to be shared in our Plugin Library with the broader Medusa community.