Transaction Status

Before a customer's transaction is complete, merchants can use the transaction verification API to authenticate the legitimacy of their customer's transaction. It is, therefore, a standard practice to verify the status of a transaction after it has been completed.

Implementation

Let's walk you through the process. Here is an implementation

var request = require('request');
  var options = {
    'method': 'GET',
    'url': 'https://pay.netapps.ng/pg/api/v1/transaction/status/NT-28e275b3e5a998',
    'headers': {
      'Authorization': 'Bearer xxxxxxxxxxxxxxxxxxxxxxxxx'
    }
  };
  request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
  });

Let's take a closer look at the request

  • The NT-28e275b3e5a998 in the path of the url is the txRef which serves as a unique identifier for the transaction. It is required to verify a transaction
{
  "event": "PAYMENT_FAILED",
  "data": {
    "amount": 1000.0,
    "appFee": 1.4,
    "merchantFee": 14.0,
    "txIsSucces": false,
    "currency": "NGN",
    "checkoutPoint": "http://localhost",
    "paymentRef": "123456789",
    "merchantRef": "123456789",
    "paymentChannel": "Card",
    "deviceFingerPrint": "2345678",
    "message": "Testing",
    "txStatus": "FAILED",
    "txTimestamp": "May 13, 2022, 4:31:11 PM",
    "customer": {
      "fullname": "Customer",
      "email": "[email protected]",
      "phone": "081543946918",
      "joinedAt": "May 13, 2022, 4:22:52 PM"
    },
    "card": {
      "first": "520473",
      "last": "2449",
      "expiry": "12/25",
      "cardType": "Master Card"
    }
  }
}