idpay_ir
v1.2.0
Published
Payment utility for idpay.ir payment gate
Downloads
2
Readme
IDPay Create, Verify Payments
Installation
This is a Node.js module available through the
npm registry.
Before installing, download and install Node.js.
Installation is done using the
npm install
command:
$ npm install idpay_ir
Instantiate module
const idpay = require('idpay_ir')(your-merchant-id, sandbox);
Example:
const idpay = require('idpay_ir')('6a7f99eb-7c20-4412-a972-6dfb7cd253a4', true);
Create Payment Link:
idpay.create(order_id, amount, callback, desc = '', name = '', phone = '', mail = '');
Example:
let res = await idpay.create('12345678', 10000, 'https://app.io/cb');
console.log(res);
Output Example:
{
"id": "1dbebd143d9f4b422532502753fb00f0",
"link": "https://idpay.ir/p/ws-sandbox/1dbebd143d9f4b422532502753fb00f0"
}
Validate Payment:
idpay.validate(order_id, token);
Example:
let res = await idpay.validate('12345678', '1dbebd143d9f4b422532502753fb00f0');
console.log(res);
Output Example:
{
"status": 100,
"track_id": "190080",
"id": "1dbebd143d9f4b422532502753fb00f0",
"order_id": "12345678",
"amount": "10000",
"date": "1586517391",
"payment": {
"track_id": "75809406",
"amount": "10000",
"card_no": "123456******1234",
"hashed_card_no": "E59FA6241C94B8836E3D03120DF33E80FD988888BBA0A122240C2E7D23B48295",
"date": "1586517391"
},
"verify": {
"date": 1586517870
}
}