Developer - API - History

function history(array $params = array())

POST Get history
Parameter Type Value Required Description
$params array array with key, value pairs No History parameters
Key Name Value Type Value Required Description
batch int 123456 No Selects transactions that has such batch
date_from date date format Y-m-d No Selects all transactions made from this date
date_to date date format Y-m-d No Selects all transactions made until this date
purse string U12345678 No Selects all transactions that were send / receive by your purse
account_purse string U87654321 No Selects all transactions that were send / receive by account purse
type string transfer - Transfer
transfer_api - Transfer by api
transfer_sci - Transfer by sci
No Selects all transactions by provided transaction type
status string pending
completed
cancel
No Selects all transactions by provided transaction status
payment_id string ID-123 No If present on input, only transactions that have this value as a payment_id are displayed
rows_per_page int 10 No How many transactions to see per page
current_page int 1 No If you have more than one page in the list, this indicates on which page you are, or you want to go

Sometimes it may happen that API may not work due to server or developer fault. To identify the problem, API returns error code with message what has happend wrong.

Error Code Description
-1 API information is not valid
-2 API was disabled
-3 This IP %s has no access
1 Date is not valid
2 Date is out of range. Maximum range is 3 months
3 Transaction type is not valid
4 Transaction status is not valid

Code Snippets

<?php
// Include lib
require_once 'path/to/entromoney/api/api.php';

// Api config
$config = array();
$config['api_user']	= 'ACCOUNT_ID';
$config['api_id']	= 'API_ID';
$config['api_pass']	= 'API_PASS';

// Call lib
try {
	$api = new Paygate_Api($config);
}
catch (Paygate_Exception $e) {
	exit($e->getMessage());
}

$params = array();
$params['rows_per_page'] = 2;
$res = $api->history($params);
print_r($res);
?>

Response

stdClass Object
(
    [status] => 1
    [result] => stdClass Object
        (
            [transactions] => Array
                (
                    [0] => stdClass Object
                        (
                            [batch] => 123456
                            [date] => 2013-12-18 - 16:20:28
                            [type] => (Api) Received from
                            [type_code] => transfer_api
                            [account_purse] => U52698364
                            [status] => completed
                            [amount] => +200
                            [fee] => -0
                            [net] => +200
                            [balance] => 1024.95
                            [purse] => U1000000
                            [desc] => TRANSFER-4I
                            [payment_id] => 4
                        )
                    [1] => stdClass Object
                        (
                            [batch] => 123455
                            [date] => 2013-12-10 - 22:15:37
                            [type] => (Sci) Received from
                            [type_code] => transfer_sci
                            [account_purse] => U1000002
                            [status] => completed
                            [amount] => +45
                            [fee] => -0
                            [net] => +45
                            [balance] => 824.95
                            [purse] => U1000000
                            [desc] => TRANSFER-1I
                            [payment_id] => 1
                        )
                )
            [rows_per_page] => 2
            [current_page] => 1
            [total_page] => 36
        )
)