Jump to content

Creating an invoice from Service


Jake

Recommended Posts

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?

Link to comment
Share on other sites

The answer to you first question is no, the cron will not automatically invoice created services, though it does automatically invoice renewing service.

 

For your second question, it is trying to default the service_ids parameter since you have accidentally written services_ids.

Link to comment
Share on other sites

OK...I updated that but now it gives me the following error:

 

 [lines[0][description]] => stdClass Object
        (
            [empty] => Please enter a line item description.
        )

The documentation does not show that I need to provide that information.  How am I supposed to add that info?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...