This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

polypay
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

polypay.js

polypay.js

A node.js package for making payment transactions with different Iranian IPGs with one single API.

📖 Documentation

🔌 Installation

For npm users:

npm install polypay

For yarn users:

yarn add polypay

🚀 Usage

Examples

Getting a payment driver

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

Requesting for payment

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

Verifying the payment in callback

app.all('/callback', async (req, res) => {
  const receipt = await driver.verifyPayment({
      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

🤝 Contribution

Please read Contribution and Code Of Conduct.

📝 License

MIT License - Please see License File for more information.

Package Sidebar

Install

npm i polypay

Weekly Downloads

0

Version

1.1.1

License

MIT

Unpacked Size

967 kB

Total Files

87

Last publish

Collaborators

  • alitnk