Transaction Verification
Before a customer 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
curl --location --request GET 'https://www.netappspay.com/pg/api/v1/transaction/status/NT-28e275b3e5a998' \
--header 'Authorization: Bearer 4c219509e1ad4629823a91255bd7b477'
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://www.netappspay.com/pg/api/v1/transaction/status/NT-28e275b3e5a998',
'headers': {
'Authorization': 'Bearer 4c219509e1ad4629823a91255bd7b477'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://www.netappspay.com/pg/api/v1/transaction/status/NT-28e275b3e5a998")
.header("Authorization", "Bearer 4c219509e1ad4629823a91255bd7b477")
.asString();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://www.netappspay.com/pg/api/v1/transaction/status/NT-28e275b3e5a998"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer 4c219509e1ad4629823a91255bd7b477")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var headers = {
'Authorization': 'Bearer 4c219509e1ad4629823a91255bd7b477'
};
var request = http.Request('GET', Uri.parse('https://www.netappspay.com/pg/api/v1/transaction/status/NT-28e275b3e5a998'));
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
import requests
url = "https://www.netappspay.com/pg/api/v1/transaction/status/NT-28e275b3e5a998"
payload={}
headers = {
'Authorization': 'Bearer 4c219509e1ad4629823a91255bd7b477'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Let's take a closer look at the request
- The
NT-28e275b3e5a998in the path of the url is the txRef which serves as a unique identifier for the transaction.It is required to verify a transaction
Responses
{
"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"
}
}
}
Updated about 2 years ago
