Create a user - magnussolution/magnusbilling-api GitHub Wiki

Create a new user

<?php
require_once "vendor/autoload.php";

use magnusbilling\api\magnusBilling;

$magnusBilling             = new MagnusBilling('API KEY', 'SECRET KEY');
$magnusBilling->public_url = "http://1.1.1.1/mbilling"; // Your MagnusBilling URL

/*
The method create need 2 data, the module and the fields, the fields need to be an array().
*/

//All parameters are optionals.
$result = $magnusBilling->createUser([
      'username' => 'the new username',
      'password' => 'password',
      'active' => '1',
      'firstname' => 'my name', 
      'password' => 'new_password', 
      'email' => 'email',
      'id_group' => $id_group, //DEFAULT: GROUP IS USER
      'id_plan' => $id_plan, //DEFAULT: GET THE FIRST PLAN THAT YOU SET TO USE IN SIGNUP      
      'credit' => 0, //DEFAULT: GET THE CREDIT FROM THE PLAN
    ]);

print_r($result);