Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Hi Jono, I have tried your basic example and indeed it does work as expected which means it must be something im doing. Ill keep investigating and post a solution here when i find it. Thanks!
  2. Hi Jono, the $services_renew parameter is set to false, although i had tried it as true. Im wondering do i need to explicitly set the date_renews or the date_last_renewed when adding the service? Am i following the typical workflow for this? should the $packages parameter contain anything if i'm not using coupons? is it something to do with the due_date? does it need to be set to before the service creation or something?
  3. I add a service to a client account for today's date and when i run Invoices->createFromServices it will show on the invoice lines <ITEM_NAME> (Jan 05, 2018 - Feb 05, 2018). How can i generate the very first bill when adding a service via the API i.e (Dec 05, 2017 - Jan 05, 2018)?
  4. Ok I now see i have 'due_date' rather than 'date_due'. I had previously been using the 'Invoice->createFromService' and its parameter is 'due_date' rather than 'date_due'; All working ok now!
  5. OK I have since solved this issue. the above php array is purely for display purposes but i'm actually consuming the blesta API using javascript. The problem lay in how I was converting the vars to a query string which I have now solved using the 'qs' node module and some tweaks to ensure PHP could parse the complex array OK from the query string. I now have a new issue as is usually the case lol. the 'Invoices->add' request is show a more friendly error - { "message":"The request cannot be fulfilled due to bad syntax.", "errors":{ "date_due":{ "format":"The due date is in an invalid date format." } }, "response":null } my date format is this: { 'date_billed' : '2017-02-03 11:36:11', 'due_date' : '2017-02-10 11:36:11' } Is there something wrong with those dates in combination??
  6. Hi There, I'm trying to generate an invoice using the API. I have included the contents of my 'vars' parameter that is sent to the API. The response i'm getting is just {"message":"The format requested is not supported by the server.","response":null} Is it something simple i'm missing here? Setting an option when I shouldn't be? The docs at http://source-docs.blesta.com/class-Invoices.html do not specify which options are optional on the invoice ( they do for lines of the invoice ) so I wasn't sure which ones were required. Does the invoice term need to match the service term some how? Update: I notice two of my lines below have a zero amount. I have tried without these and its the same result. Thanks in advance for any help! <?php $vars = array ( 'vars' => array ( 'client_id' => 119, 'currency' => 'GBP', 'status' => 'active', 'lines' => array ( 0 => array ( 'service_id' => 108, 'description' => 'Minute Bundles', 'amount' => 5, 'tax' => true, 'qty' => 1, ), 1 => array ( 'service_id' => 108, 'description' => 'Included Top Up', 'amount' => 0, 'tax' => true, 'qty' => 1, ), 2 => array ( 'service_id' => 108, 'description' => 'Intergalactic Minutes Bundles', 'amount' => 0, 'tax' => true, 'qty' => 1, ), 3 => array ( 'service_id' => 108, 'description' => 'Handware Option', 'amount' => 65, 'tax' => true, 'qty' => 1, ), 4 => array ( 'service_id' => 108, 'description' => 'Plumbus Deluxe McSneeze', 'amount' => 100, 'tax' => true, 'qty' => 1, ), ), 'date_billed' => '2017-02-03 11:36:11', 'due_date' => '2017-02-10 11:36:11', 'term' => 1, 'period' => 'month', 'duration' => 'indefinitely', ), ); ?>