Step 2: Here we add code to Virtuemart as an example.
First, please insert the code to administrator/com_virtuemart/classes/ps_order.php, around line 322, calling UserAddMoney function. So it will add credit to user account at DRM-X.com after customer done payment online.
Here is the sample code:
In the virtuemart folder:
$comma_order = $d["order_id"];
$dbv = new ps_DB;
$q="SELECT order_total, user_id FROM #__{vm}_orders WHERE order_id = '$comma_order' ";
$dbv->query($q);
$dbv->next_record();
$user_ids = $dbv->f("user_id"

;
$db = new ps_DB;
$q="SELECT email FROM #__users WHERE id = '$user_ids' ";
$db->query($q);
$db->next_record();
require_once('nusoap.php'

;
$wsdl="http://www.drm-x.com/haihaisoftlicenseservice.asmx?wsdl";
$AdminEmail="john.gao@haihaisoft.com";
$WebServiceAuthStr="123456";
$client=new soapclient2($wsdl, 'wsdl'

;
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
$param = array(
'AdminEmail' => $AdminEmail,
'WebServiceAuthStr' => $WebServiceAuthStr,
'Money' => $dbv->f("order_total"

,
'UserEmail' => $db->f("email"
);
$result = $client->call('UserAddMoney', array('parameters' => $param), '', '', true, true);
$license= $result['UserAddMoneyResult'];