Skip to main content

Overview

When a customer completes a payment on Novac’s checkout, they are redirected to the callbackURL you provided during checkout initialization.
Novac automatically appends query parameters such as the transaction reference and status to this URL. You can then use this reference to verify the transaction directly from your server before confirming payment or giving value to the customer.
This approach ensures you are validating each transaction against Novac’s API response, not relying solely on the status parameter in the callback.

Handling Callback URL After Payment Completion

When payment is completed, We redirects the user to your callback URL as shown below:
GET {your-callback-url}?reference=<string>&status=<string>
To verify a transaction, make a GET request to api/v1/checkout/{transactionRef}/verify by passing the transaction reference as a path parameter.
It’s important that you don’t rely on the status alone via callbackURL, Always verify a transaction before marking it as complete.
Request
curl --request GET \
  --url https://api.novacpayment.com/api/v1/checkout/{transactionRef}/verify \
  --header 'Authorization: <api-key>'
Response
{
  "status": true,
  "message": "Transaction details retrieved successfully",
  "data": {
    "status": "pending | successful | failed",
    "id": 0,
    "transactionReference": "string",
    "amount": 0,
    "chargedAmount": 0,
    "currency": "NGN",
    "transactionFee": 0,
    "gatewayResponseCode": "00",
    "gatewayResponseMessage": "string",
    "domain": "string",
    "channel": "string",
    "requestIp": "string",
    "paymentDescriptor": "NOVAC",
    "transactionType": "",
    "redirectUrl": "",
    "card": {
      "first6Digits": "string",
      "last4Digits": "string",
      "issuer": "",
      "country": "string",
      "type": "string"
    },
    "customer": {
      "id": 0,
      "customerCode": "string",
      "email": "string",
      "name": "string"
    },
    "transferDetail": {
      "bankCode": "string",
      "bankName": "string",
      "accountNumber": "string",
      "sessionId": "string",
      "creditAccountName": "string",
      "originatorName": "string",
      "originatorAccountNumber": "string"
    }
  }
}
You can also define a server-side route, for example /payment/callback that reads these query parameters, extracts the transaction reference, and calls Novac’s Verify Transaction API to confirm the actual payment status. Below are examples in multiple languages showing how to handle and verify the callback.
import express from "express";
import axios from "axios";

const app = express();

app.get("/payment/callback", async (req, res) => {
  const { reference, status } = req.query;

  try {
    const response = await axios.get(
      `https://api.novacpayment.com/api/v1/checkout/${reference}/verify`,
      {
        headers: {
          Authorization: `Bearer ${process.env.NOVAC_API_KEY}`,
        },
      }
    );

    const verifiedTransaction = response.data;
    console.log("Verified Transaction:", verifiedTransaction);
    res.send("Payment verified successfully!");
  } catch (error) {
    console.error("Verification failed:", error.message);
    res.status(500).send("Verification failed.");
  }
});

app.listen(3000, () =>
  console.log("Server listening on http://localhost:3000")
);