Skip to content
/ monopay Public

💳 A node.js package for making payment transactions with different payment gateways

License

Notifications You must be signed in to change notification settings

alitnk/monopay

Repository files navigation

Monopay - مونو‌پِی

monopay

Intended Runtime Environment: Node.js NPM Version License Last Comit

A node.js package for making payment transactions with different Iranian IPGs with one single API. (Previously known as "Polypay")

مونو‌پِی یک پکیج نود جی اس برای انجام تراکنش‌های آنلاین با سرویس های درگاه پرداخت مختلف با یک رابط واحد است.

در صورتی که از پکیج خوشتون اومده، بهش استار بدید تا بیشتر دیده بشه و مشکلاتش زودتر برطرف بشن. 🙏

لطفا قبل از استفاده در پروداکشن،‌ از پایدار بودن درایور مطمئن شوید. - جدول پشتیبانی درایور ها

📖 Documentation

🔌 Installation

For npm users:

npm install monopay

For yarn users:

yarn add monopay

🚀 Usage

⚒ Examples

Getting a payment driver

const driver = getPaymentDriver('zibal')({
  merchantId: 'merchant-id',
  sandbox: true,
});

Requesting for payment

const paymentInfo = await driver.request({
  amount: 200000, // IRR
  callbackUrl: 'mysite.com/callback',
});

Verifying the payment in callback

app.all('/callback', async (req, res) => {
  const receipt = await driver.verify(
    {
      amount: 200000, // IRR
      referenceId: 1234,
    },
    { ...req.query, ...req.body },
  );

  res.json({
    referenceId: receipt.referenceId,
    success: true,
    message: 'The payment transaction was successful.',
  });
});

A full example with express can be found here

📜 TODO List

  • Support for all the drivers
  • Add NestJS module integration
  • Examples for Koa, Fastify and NestJS
  • "Re-brand" (Logo and banner)

🤝 Contribution

Please read Contribution and Code Of Conduct.

📝 License

MIT License - Please see License File for more information.