🥈Verify Payments

Verify transactions after payments using Lazerpay's verify api

Transactions are being verified using the Verify Payments endpoint from your server using your transaction reference or with the address property whose value is the payment address returned from the initialise payment function.

Verify Payment API

To verify transactions using the Lazerpay endpoint, you will make a get request to the verify transaction endpoint from your server using your transaction reference or with the address property.

Here's a code sample for verifying transactions:

GET https://api.lazerpay.engineering/api/v1/transaction/verify/:address_or_reference

Path Parameters

Headers

  {
  "status": "success",
  "statusCode": 200,
  "message": "Verification successful",
  "data": {
    "id": "92924b81-11fd-418f-bc4f-3ddab7e79e6b",
    "reference": "nGfVSuX3IK",
    "senderAddress": "0x451dEFC27B45808078e875556AF06bCFdC697BA4",
    "recipientAddress": "0xCfe4e688c47Af0689224da9B9bAB51B4dA38D11c",
    "actualAmount": 0.51,
    "amountPaid": 0.51,
    "amountPaidFiat": 299.7984,
    "fiatAmount": 300,
    "amountReceived": 0.52,
    "amountReceivedFiat": 305.6768,
    "coin": "BUSD",
    "currency": "NGN",
    "hash": "0xc80d9fa8ba4b13c685ad12ffdeb2a6f803f7c3832f51cc0376e5ff9a74c6fd93",
    "blockNumber": 16684797,
    "type": "received",
    "acceptPartialPayment": true,
    "status": "confirmed",
    "network": "mainnet",
    "blockchain": "Binance Smart Chain",
    "customer": {
      "id": "1c4d885e-4058-45f0-8d74-ff79fe439e75",
      "customerName": "Abdulfatai Suleiman",
      "customerEmail": "[email protected]",
      "customerPhone": null
    },
    "paymentLink": {},
    "paymentButton": {},
    "feeInCrypto": 0.01
  }

Important Note from the verification response

  1. The actualAmount key is the amount that you intended to charge the customer in crypto.

  2. The amountPaid key is the crypto amount that is being paid to the merchant. It is usually in the coins that we support

  3. The amountPaidFiat is the fiat value of the crypto amount being paid to the merchant

  4. The fiatAmount is the fiat value of the amount that you intended to charge the customer. This is usually in the merchant's local currency.

The amountReceivedFiat and amountReceived values is the amountPaidFiat plus Lazerpay fees and the AmountPaid plus Lazerpay fees respectively.

From Official JS SDK

With the JS SDK, you have access to the confirmPayment object which is used to verify any payment in the Lazerpay platform.

const LazerPay = require('lazerpay-node-sdk');

const lazerpay = new LazerPay(LAZER_PUBLIC_KEY, LAZER_SECRET_KEY);

const confirm_tx = async () => {
  try {
    const payload = {
      identifier: 'address generated or the reference generated by you from initializing payment',
    };

    const response = await lazerpay.Payment.confirmPayment(payload);

    console.log(response);
  } catch (error) {
    console.log(error);
  }
};

If you offer digital value like airtime, wallet top-up, digital credit, etc, always confirm that you have not already processed the value for that transaction to avoid double fulfillments, especially, if you also use webhooks.

Last updated