Using the API, I am trying to dynamically add a service as active and create an invoice.
The service should be renewable and invoice recurring as a result.
//Add service to client
$data = array(
'vars' => array(
'package_group_id' => "8",
'pricing_id' => "6",
'client_id' => "31",
'module_row_id' => "5",
'status' => "active"
)
);
$response = $api->post("services", "add", $data);
When I log into the admin portal, the service is there yet no invoice is generated.
As such, I attempted to generate an invoice using
Add Invoice from Service
$data = array(
'client_id' => 31,
'service_ids' => array('service_ids' => 6),
'currency' => "USD",
'due_date' => "2014-09-13 10:54:30",
);
//Create Invoice for service
$response = $api->post("invoices", "createFromServices", $data);
The invoice then appears, yet I do not know if this will automatically create an invoice after every renewal period as it was not generated on its own before calling this function.
Please advise