Skip to content

Transaction Query API

We provide you an View API Key with the necessary authority to access your users transaction data.

  • method : GET

  • endpoint : /info/transaction/

Examples

```javascript tab="javascript" fetch("https://api.thesmartgateway.com/info/transaction", { method: "GET", headers: { "Authorization":"" }, qs: { fields: "Agent,PayStatus,Amount,TransactionDate", ordering: "-Amount", size: "5"
} }) .then(response => { console.log(response); }) .catch(err => { console.log(err); });


```javascript tab="node"
var request = require("request");
var options = {
  method: "GET",
 headers: {
    "Authorization":"<api_key>"
    },
  url: "https://api.thesmartgateway.com/info/transaction/",
  qs: {
    fields: "Agent,PayStatus,Amount,TransactionDate",
    ordering: "-Amount",
    size: "5"
  }
};

request(options, function(error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

```go tab="Go" package main

import ( "fmt" "io/ioutil" "net/http" )

func main() {

url := "https://api.thesmartgateway.com/info/transaction/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization","<api_key>")

q := req.URL.Query()
q.Add("size", "5")
q.Add("TransactionDate__range", "2020:01:23-2020:03:24")
q.Add("ordering", "-Amount")
req.URL.RawQuery = q.Encode()
res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))

}


```python tab="python"
import requests
url = "https://api.thesmartgateway.com/info/transaction/"
querystring = {
  "fields": "Agent,PayStatus,Amount,TransactionDate",
  "ordering": "-Amount",
  "size": "5",
  }
response = requests.request("GET", url,headers=dict(Authorization="<apit_key>"), params=querystring)
print(response.text)

Params

MerchantTransactionID : string

PayStatus: string

Options

FAILED,SUCCESS,PENDING

TransactionDate__range: Format:(from-to) year:month:day:hour-year:month:day:hour

size: int

Note

No. of items to return from the query

ordering: String

Options

Amount, TransactionDate

Adding prefix - will order the respose descending

Returns

{
  "count": 149,
  "previous": null,
  "results": [
    {
      "id": 70,
      "rid": "MTphZ01BU3FYaHpHdVVFSFdXaXRYUzoxaXpkb1U6TDFud3hLeTZfdnhmMWh3QnQ4dkxHb2ZwcHVr",
      "TransactionID": "MOLN-KHT:990696835504:da1412ba-87f6-405c-982a-5e5433c57f44",
      "AgentReference": null,
      "Agent": "KHALTI",
      "MerchantTransactionID": "da1412ba-87f6-405c-982a-5e5433c57f44",
      "TransactionDate": "2020-02-06T15:36:48.452484+05:45",
      "Amount": "238000.00",
      "PayStatus": "FAILED",
      "Comment": "Left during payment",
      "Remarks": "FAILED",
      "Merchant": 1,
      "TransactionRequest": 114
    }
  ]
}