1.1.1 • Published 3 years ago
polypay v1.1.1
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.