Add Transaction

For the billed users, the payment against the invoices appear in the transactions tab at the enduser panel.

In the event of any adhoc payment from the user, the admin can create transaction entry for that payment using the Add Transaction API which would appear in the enduser panel as “paid”.

The API response will contain “done” as the transaction ID of the newly added transaction.

HTTP Request

https://hostname:4085/index.php?act=addtransaction

Parameters

NameMethodValueDescriptionRequired
actGETaddtransactionThe action will return done as transaction ID on successYes
uidPOSTIntThe user ID of the user making the transactionYes
datePOSTtextThe date on which the transaction was made, should be in the format DD/MM/YYYYYes
timePOSTtextThe time at which the transaction was made, should be in the format HH:MM:SSYes
gatewayPOSTtextThe name of the payment gateway used for the transactionYes
tokenPOSTtextA reference to the payment transactionNo
amtPOSTIntThe transaction amountYes
feesPOSTIntFees charged by the GatewayNo

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['uid'] = 57;
    $post['date'] = '18/09/2018';
    $post['time'] = '12:33:55';
    $post['gateway'] = 'UPI';
    $post['amt'] = 1000;

    $output = $admin->addtransaction($post);

    print_r(json_encode($output));
?>

Output

{
    "title": "Add Transaction",
    "done": "2",
    "timenow": 1537275189,
    "time_taken": "0.219"
}
Was this helpful to you?