GET /payments/getpayments
Description
- The /payments/getpayments endpoint/action allows you to get the open, stored, and paid payments for affiliates
Resource URL
- http://domain/api/payments/getpayments
- Replace domain with the nats domain
Request Method
Response Format
Authentication
Parameters
Paremeters can be sent as url encoded params. See examples below.
- loginid: The affiliate loginid
- filter_inhouse: Filter inhouse affiliates. Can be set to 1 or 0
- start_date: The start date
- payvia_type_id: The payvia type id
- payment_type: The payment type
- open: Whether the payment is open or not
- stored: Whether the payment is stored or not
- paid: Whether the payment is paid
Example Request
GET
http://domain/api/payments/getpayments
[
{
"2": {
"loginid": "2",
"stored": [
{
"paymentid": "1",
"loginid": "2",
"payvia_type_id": "1",
"payvia_type_nice": "Check ($0.00)",
"start": "1426564800",
"end": "1426564800",
"type": "5",
"type_nice": "Manual Invoice",
"amount": "66600",
"stored": "1426564800",
"paid": "0",
"paid_reference": "",
"received": "0"
}
]
},
"6": {
"loginid": "6",
"stored": [
{
"paymentid": "2",
"loginid": "6",
"payvia_type_id": "1",
"payvia_type_nice": "Check ($0.00)",
"start": "1426564800",
"end": "1426564800",
"type": "5",
"type_nice": "Manual Invoice",
"amount": "66599",
"stored": "1426564800",
"paid": "0",
"paid_reference": "",
"received": "0"
}
]
}
}
]
[
[
[
"No Payments Found"
]
]
]
Example Code
PHP
<?php
$curl = curl_init();
$data = array(
'payvia_type_id' => 1,
'stored' => '1'
);
$data_string = http_build_query($data);
$url = 'http://domain/api/payments/getpayments?'.$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);
//decodes json response and converts it to a php associative array
$result = json_decode($resp, true);
//prints the associative array representation of the JSON
var_dump($result);
// 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
import json
url = 'http://domain/api/payments/getpayments'
payload = {
'payvia_type_id': 1,
'stored': '1'
}
headers = {
'api-key': '44b5498dbcb481a0d00b404c0169af62',
'api-username': 'tmm1phrvezsbu'
}
res = requests.get(url, params=payload, 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/payments/getpayments',
method: 'GET',
qs: {
'payvia_type_id': 1,
'stored': 1
},
json: true,
headers: {
'api-key': '44b5498dbcb481a0d00b404c0169af62',
'api-username': 'tmm1phrvezsbu'
}
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(JSON.stringify(body));
}
else{
console.log(body);
}
}
request(options, callback)
Curl
curl -X GET -H "API_key: 44b5498dbcb481a0d00b404c0169af62" -H "api_userNAme: tmm1phrvezsbu" 'http://domain/api/payments/getpayments?payvia_type_id=1&stored=1'