NATS4 REST API Get Transaction Report
From TMM Wiki
Jump to navigationJump to searchThe printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
GET /transactions
Description
- NATS4 supports an API resource to grab all the stats used within the NATS transactions report.
Resource URL
- http://domain/api/report/transactions
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Paremeters can be sent as url encoded params.
- start_time - Freeform start date for the stats.
- type: string
- required
- end_time - Freeform end date for the stats.
- type: string
- required
- offset - The starting point of the report
- type: string
- optional
- count - Limit the report to a specific amount of entries
- type: string
- optional
And the other parameters this API call can take
- filter_process_type - Only see stats for the specific process type passed in. See below for more information regarding the periods within NATS
- type: string
- optional
Process Types
! # | Name |
0 | cc |
1 | check |
2 | dialer |
3 | elv |
4 | asian |
5 | ob |
6 | sms |
7 | 900 |
8 | inv |
9 | trans |
10 | combo |
11 | pre |
12 | phone |
13 | gphone |
14 | dp |
15 | instant |
16 | idl |
17 | snp |
18 | cnd |
19 | knd |
20 | eay |
21 | pys |
22 | bpy |
23 | eao |
24 | prz |
25 | voucher |
26 | idv |
27 | pound |
28 | dtm |
29 | bcoin |
30 | bd |
31 | poa |
32 | sof |
33 | paypal |
34 | psc |
35 | cbuy |
36 | gpay |
37 | eps |
38 | mpass |
39 | pin |
40 | atm |
41 | cash |
42 | ewallet |
43 | va |
44 | dc |
45 | astro |
46 | sepa |
47 | tgreso |
48 | telepay |
49 | poliau |
50 | polinz |
51 | ypay |
52 | apc |
53 | gc |
54 | wap |
55 | mobile |
56 | maestro |
57 | bccard |
58 | mistercash |
59 | enets |
60 | abaqoos |
61 | poli |
62 | neosurf |
63 | epaybg |
64 | safetpapy |
65 | toditocash |
66 | banklink |
67 | ekonto |
68 | sporopay |
69 | unet |
70 | ticketp |
71 | postepay |
72 | euteller |
73 | qiwi |
74 | boletoo |
75 | ymoney |
76 | switch |
77 | bz |
78 | io |
Example Request
GET
http://domain/api/report/transactions
- Response:
{"1239": {"transaction_id":"1239", "identid":"104", "loginid":"9", "networkid":"0", "biller_time":"1530156662", "server_time":"1530162004", "biller_transid":"NETBILLING:113455437704", "billerid":"2", "amount":"3000", "biller_amount":"3000", "biller_currency":"USD", "exchange_rate":"10000", "trans_type_id":"2", "member_subscription_id":"464", "charges":"0", "charge_deduct":"0", "process_type":"paypal", "related_transid":"", "historical":"0", "retro_payout":"0", "retrieval_type":"2", "related_trans_type":"0", "taxes":"0", "taxes_deduct":"0", "transaction_passthrough1":"", "transaction_passthrough2":"", "transaction_passthrough3":"", "transaction_passthrough4":"", "transaction_passthrough5":"", "subid1":"0", "subid2":"0", "campaignid":"0", "campaign_name":"Default", "programid":"7", "program_name":"200payout", "siteid":"1", "site_name":"site1", "tourid":"1", "tour_name":"MAIN", "optionid":"1", "option_name":"30 for 30 join", "biller_name":"NETBILLING", "country_iso2":"US", "country_iso3":"USA", "country_isoalpha":"840", "country_name":"USA", "affiliate_username":"test123a", "affiliate_email":"test123a@test123a.com", "trans_type":"rebill", "process_type_id":"33", "process_type_name":"PayPal", "memberid":"343", "member_username":"test2342342a", "member_email":"test@test1.com", "member_city":"test", "member_state":"DE", "member_zip":"23433", "member_country":"US", "member_shipping_city":"", "member_shipping_state":"", "member_shipping_zip":"", "member_shipping_country":"", "member_ip_hex":"0xc0a80155", "member_ip":"192.168.1.85", "refurl_lookup_id":"28", "memberidx":"NETBILLING:113610165928", "custom1":"", "custom2":"", "custom3":"", "custom4":"", "custom5":"", "custom6":"", "custom7":"", "custom8":"", "custom9":"", "custom10":"", "passthrough1":"", "passthrough2":"", "passthrough3":"", "passthrough4":"", "passthrough5":"", "refurl":"" } }
Example Code
PHP
<?php $curl = curl_init(); $data = array( 'start_time' => '2018-01-06', 'end_time' => '2018-06-14' ); $data_string = http_build_query($data); $url = 'http://domain/api/report/transactions?'.$data_string; $headers = array( 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: tmm1phrvezsbu' ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_URL, $url); $resp = curl_exec($curl); //dumps an associative array representation of the json var_dump(json_decode($resp, true)); // Close request to clear up some resources curl_close($curl); ?>
Python
- This example requires pip and the request library which can be installed via pip by: 'pip install requests'
import requests url = 'http://domain/api/report/transactions' params = { 'start_time' => '2018-01-06', 'end_time' => '2018-06-14' } headers = { 'api-key': '44b5498dbcb481a0d00b404c0169af62', 'api-username': 'tmm1phrvezsbu' } res = requests.get(url, params=params, headers=headers) print res.json()
node.js
- This example requires npm and the request module which can be installed via npm by: 'npm install request'
var request = require('request'); var options = { url: 'http://domain/api/report/transactions', method: 'GET', qs: { 'start_time' => '2018-01-06', 'end_time' => '2018-06-14' }, json: true, headers: { 'api-key': '44b5498dbcb481a0d00b404c0169af62', 'api-username': 'tmm1phrvezsbu' } }; function callback(error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } else{ console.log(body); } } request(options, callback);
Curl
curl -X GET 'http://domain/api/report/transasctions?view=year&start_time=2018-01-06&end_time=2018-06-14' -H "api-key: 44b5498dbcb481a0d00b404c0169af62" -H "api-username: tmm1phrvezsbu"