API Reference

Query Payment

This api will provide the information of a specific payment.

Through this API, a information of a specific payment can be found. After calling the Create Payment API, Query Payment api can be called anytime

📘

Endpoint

{base_url}/searchTrx/{trxID}

{base_url} is the api endpoint (sandbox or live). {trxID} is the merchant's provided Transaction ID.

Request Header

Include the following request headers:

ParameterValueRequired
AuthorizationToken found from the Get Token APIYES
Content-Typeapplication/jsonYES
Acceptapplication/jsonNO

Response Parameters

ParameterTypeDescription
statusBooleanRequest status (True or False)
statusMessageStringRequest status message
dataArrayData related to payment. See below response

Example Code

<?php

$curl = curl_init();

$trxID = "Your Transaction ID";

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://vivaropay.live/api/v1.0.0-beta/payment/sandbox/searchTrx/'.$trxID,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

curl --location 'http://localhost:8080/api/v1.0.0-beta/payment/secure/searchTrx/547844SDDHSDSD' \
--header 'Authorization: Bearer Token'

Success Response

{
    "status": true,
    "statusMessage": "Transaction data found",
    "data": {
        "pg_txnid": "VPCJ5QGCRW",
        "merchant_txnid": "547844SDDHSDSD",
        "amount": 500,
        "charge": 10,
      	"stored_amount": 490,
        "method": "nagad",
        "method_txnid": "547ASDDXSD",
        "sender_number": "01878460662",
        "meta_data": null,
        "callback_url": "https://yourdomain.com/callback",
        "webhook_url": "https://yourdomain.com/webhook",
        "created_at": "2024-01-02 11:26:40",
        "paid_at": "2024-01-02 11:40:40",,
        "status": "success"
    }
}

Error Response

{
    "status": false,
    "statusMessage": "No transaction data found"
}