Developer - API - Send money

function transfer($sender_purse, $receiver_purse, $amount, $desc = '', $payment_id = '')

POST Send money
Parameter Type Value Required Description
$sender_purse string U12345678 Yes Your purse to spend from
$receiver_purse string U87654321 Yes Account purse to spend to
$amount float 1.00, 15.25 Yes Amount to send in float type format
$desc string Test No Transfer details
$payment_id string ID-123 No Optional merchant reference number

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 Sender does not exist
2 Receiver does not exist
3 Receiver is not valid
4 Amount is not valid
5 Current balance is not enough to pay
6 Current balance 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());
}

// Send money
$sender_purse	= 'U12345678';
$receiver_purse	= 'U87654321';
$amount			= 1.00;
$desc			= 'Test';
$payment_id		= 'ID-123';
$res = $api->transfer($sender_purse, $receiver_purse, $amount, $desc, $payment_id);
print_r($res);
?>

Response

stdClass Object
(
    [status] => 1
    [result] => stdClass Object
        (
            [batch] => 110
            [date] => 2013-12-10 - 22:15:37
            [type] => (Api) Sent to
            [type_code] => transfer_api
            [account_purse] => U87654321
            [status] => completed
            [amount] => -1
            [fee] => -0.06
            [net] => -1.06
            [balance] => 1023.89
            [purse] => U12345678
            [desc] => Test
            [payment_id] => ID-123
        )
)