I have a two part question.
First, I'm trying to figure out the workflow for creating a service from invoice. My current workflow in my app is the following:
Create user -> add Credit card data -> create a service -> create the invoice -> pay the invoice with the save CC data ->update the service to active.
My question is if I create a service will the system automatically create an invoice when the CRON is run or should I do it through the API. The way I am currently doing it seems like a lot of calls and I would prefer to lower the amount of calls I am making. Is there a better way?
Secondly I am trying to create an invoice from a service but it is giving me an error
$BlestaCreateData = array(
'client_id' => 23,
'services_ids' => array(26),
'currency' => 'USD',
'due_date' => date("c"),
'allow_pro_rata' => false,
'services_renew' => true,
);
$response = $this->blestaapi->post('invoices', 'createFromServices', $BlestaCreateData);
echo '<pre>';
$RetVal = $response;
print_r($response->response());
print_r($response->errors());
The error is
Class Object
(
[error] => stdClass Object
(
[message] => An unexpected error occured.
[response] => Internal error: Failed to retrieve the default value
)
)
What am I missing?