0

Use the Quickpay API in nodejs how can i integrate the payment? i tried something but it returns error. card details are like this :number: 1000 0000 0008,expiry:1122,cvv:158,"type":"Visa"

Here is my code

function processCreatePayment(req, res, next) {
    if (req.session.checkout) {
        if (req.session.checkout.total === 0) {
            return res.send("please checkout before making payment ");
        }
    }

    var parameters = {
        "version": "v10",
        "merchant_id": "12345",
        "agreement_id": "e72fc85b87d2b342f53e64a3492ee43322283aa8",
        "amount": "100",
        "currency": "dkk",
        "order_id": moment().unix()
    };
    quickPay.post("payments/", version, parameters)
        .then(function(result) {
            res.send(result);
            transaction_id = result.id;
            date = result.created_at;
        })
        .catch(function(err) {
            res.send(err.response);
        });
}

function processAuthorize(req, res, next) {
    var card ={
        "card[number]" : req.body.number,
        "card[expiration]" : req.body.expiry,
        "card[cvd]" : req.body.cvv,
        "acquirer" : "clearhaus",
        "card[type]":req.body.type
    }
    console.log(card);
    //req.session.transaction_id = transaction_id;
    console.log("cards/"+ transaction_id + "/authorize", version, card);
    quickPay.post("cards/"+ transaction_id + "/authorize", version, card)
        .then(function(result) {
            res.send(result);
        })
        .catch(function(err) {
            res.send(err.response);
        });
}
 getting this error 
output:
{
  "statusCode": 404,
  "body": {
    "error": "Not found: NotFoundError"
  },
  "headers": {
    "content-type": "application/json",
    "date": "Mon, 09 Jan 2017 06:39:53 GMT",
    "server": "nginx",
    "x-content-type-options": "nosniff",
    "content-length": "36",
    "connection": "Close"
  },
  "request": {
    "uri": {
      "protocol": "https:",
      "slashes": true,
      "auth": null,
      "host": "api.quickpay.net",
      "port": 443,
      "hostname": "api.quickpay.net",
      "hash": null,
      "search": null,
      "query": null,
      "pathname": "/cards/78122144/authorize",
      "path": "/cards/78122144/authorize",
      "href": "https://api.quickpay.net/cards/78122144/authorize"
    },
    "method": "POST",
    "headers": {
      "Accept-Version": "v10",
      "Authorization": "Basic OmU3MmZjODViODdkMmIzNDJmNTNlNjRhMzQ5MmVlNDMzMjIyODNhYTgyMWRkOTNjYTI1Mjc4ZDI1MzcxNWE5MDI=",
      "accept": "application/json",
      "content-type": "application/json",
      "content-length": 118
    }
  }
}

How can I get the proper result?

dgvid
  • 26,293
  • 5
  • 40
  • 57
Schüler
  • 1
  • 2
  • The 401 status indicates that the "resource" is not found, which based on a URL of "/cards/78122144/authorize" means that one of the following is incorrect: "cards", "78122144", or "authorize." Are sure the card number is valid? – dgvid Jan 10 '17 at 19:15
  • yes here it is a fake card number but am using valid one – Schüler Jan 11 '17 at 03:50

0 Answers0