QuickPay node.js REST api

时间:2016-05-25 05:55:45

标签: javascript node.js payment-gateway payment

有人参与过QuickPay REST api的工作,我通过互联网找到了一些有用的资源,但这还不够。我在Postman上测试过,效果很好

1 个答案:

答案 0 :(得分:1)

var _ = require('underscore');
var quickPay = require('quick-pay');

var version = {
    "Accept-Version": "v10",
    "Authorization": "your basic authentication"};


var transaction_id ={};

function processCreatePayment(req, res, next) {
    var random_order_id = _.random(1000, 99999999999999999999);

    var parameters = {
        "currency": "INR",
        "order_id": random_order_id 
    };
    quickPay.post("payments/", version, parameters)
        .then(function(result) {
            console.log(result);
            res.send(result);
            transaction_id = result.id;
            console.log(transaction_id);
        })
        .catch(function(err) {

            console.log(err.response);
            res.send(err.response);

        });
}

使用put方法和付款金额