MisterWebo does not currently provide support for this item.

19 comments found.

I’m stuck at something – How do you get and echo out a particular invoice URL? I want to create an invoice (following the example) and then output a link directly to that invoice.

when you do:
you get the ID of the created invoice, then now you can use invoiceGet:
$invoice will be a object with all the invoice details (see documentation “invoiceGet” for object example)

So, you can access different invoice links:
It depends on which of them you need to use.

Is there a way to search open invoices by client ID?

check invoiceList on the documentation. Use status filter:

$list=$freshbooks->invoiceList($filters, $page);

Is there a way to add an item to an invoice via item_id?

you can use itemGet() to retrieve an item by item_id and them assign its details to “line” before addLine() on the invoice creation. Check itemGet and invoiceCreate on the documentation

I need to be able to get invoice details via invoice number, as opposed to invoice id – how is this possible?

Nevermind ^ Figured it out, didn’t see the ‘number’ filter.

Is there a way to access the “support” area of Freshbooks?

do you mean using the class?

Bought this a while back but just now using it. Holy crap, thank you for making my life so much easier with this.

you’re welcome. Thanks to you for buying it!

I’m getting an error…

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /nfs/c08/h03/mnt/171249/domains/dashboard.mydomainname.com/html/easyfreshbooks.class.php on line 84

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /nfs/c08/h03/mnt/171249/domains/dashboard.mydomainname.com/html/easyfreshbooks.class.php on line 84

I’ve opened my php.ini file and added the following lines…

open_basedir “home/171249/domains/dashboard.mydomainname.com/html:/etc”

safe_mode = off

Can you help me out?


I host the site at Media Temple and found this article but it doesn’t seem to work. https://kb.mediatemple.net/questions/514/How+do+I+set+the+path+for+open_basedir%3F#gs

Hi, the script needs CURL to be available to make the calls to the API. Try contacting your hosting provider, they should solve your issue.

I am trying to enter a payment, and running into an issue.

$freshbooks=new easyFreshBooksAPI(); $freshbooks->payment->client_id=$record[‘fresh_clientid’]; $freshbooks->payment->invoice_id=$record[‘fresh_invoiceid’]; $freshbooks->payment->amount=$record[‘sales_amt’]; $freshbooks->payment->type=’Credit Card’; $freshbooks->payment->notes=’’; // Optional $payment_id=$freshbooks->paymentCreate(); echo $payment_id; $freshbooks->invoiceSendByEmail($record[‘fresh_invoiceid’],$subject,$message);

This is not echoing out a payment_id of any type. However, it is sending an email saying that a payment was made. When I look under Payments for Freshbooks, nothing is there. Please advise.

have you commented this code? :

Is there a way to remove a line from an invoice when you are updating it? Or how do I at least change the price of a particular line?

FreshBooks allows you to replace all the lines with new ones when updating an invoice. But doesn’t allow to update a line in that way.
To update a line you need to use the API’s “invoiceLinesUpdate”, check the API documentation.

I just purchased your script and it looks really good and will be a huge timesaver. I have one question Im hoping you can answer.

We are a freshbooks client and also have a payment gateway setup that currently hooks into freshbooks (PsiGate)and performs auto-billing for us each month, works great.

We want to create a simple secure webform that new clients would provide their credit card info into and then we want it to bill the client right then and there (not wait for them to receive an invoice and then pay) as well as add that person to freshbooks and setup recurring etc.

The big question for us: Is the billing for the client right then possible? In otherwords we dont want to send them an invoice via a link or email and hope they pay, we need to get their payment right away and then add them to recurring for billing say 30 days from their signup and initial payment.

I was assuming that this could be done via Freshbooks if you had a payment gateway setup (which we do). Are you familiar with how to do this? We would gladly pay you for your time as well.

Thanks again

Just to clarify, we have the SSL, the form coded etc, we just arent sure how to bill the client immediately once they give their credit card information (from our online form), all the rest we can handle. Thanks

I think you can create a recurring and playing with autobill and occurrences, as seen here:

http://developers.freshbooks.com/billing/ where it says:

Capturing credit cards on your website or application

If you feel comfortable with the security implications of taking credit cards in your application, you can pass them to FreshBooks when creating a recurring profile. Just provide the <autobill/> section.
After you pass the credit card information to FreshBooks, we recommend you destroy the data. FreshBooks will store the credit card information on our secure servers so you are not burdened with the liability of managing credit card information. If you are capturing credit cards on your website, we strongly recommend you do so over HTTPS, an encrypted protocol. Here are instructions on how to set up HTTPS in Apache and IIS.
Make sure you have one of our auto-bill capable payment gateways.

Charging your customer’s credit card for a one-time invoice

If you want to charge your customer’s credit card just for one transaction, follow the instructions above but create a subscription for today with only 1 occurences and provide the <autobill/> section.
Only one invoice will be created and their credit card will be charged only once. If you don’t specify a date on the recurring profile, the invoice will be created immediately and their credit card will be charged immediately.

Using your script and its great.

One quick item…

I create the invoice for a client and need to get the actual total amount of the invoice (with taxes included) How would I do this via your api code? So basically echoing out the value of the total invoice “amount” (there is only 1 line item)


invoiceCreate function returns the invoice ID. So you can use invoiceGet() that returns a complete invoice object: $invoice=$freshbooks->invoiceGet($invoiceID); $amount=$invoice->invoice->amount;

I’m having trouble with setting a currency for a client and/or invoice, trying to set a currency_code seems to produce no results. Could you please help?

please let me know your code

The currency_code field is not accounted for in your code, so I’ve managed to add it to Clients.php and other items that support it.

Is there a way to set who the email is from when you send an invoice out? Right now it is info@freshbooks.com. When I make invoices manually, it isn’t using that default email.

no, sorry

I am not able to get adding expenses to work. The sample usage to add an expense doesn’t work for me even. I am able to get the category_id I want by searching through the list, 00000739074 for postage. I have gotten invoicing, payments, and callbacks and everything else working and the API is wonderful. Stumped as to what I am doing wrong with expenses though. The $freshbooks->expenseCreate(1); call returns nothing though. I have declared the global $freshbooks, so that is not the problem. Any ideas?

please can you send me the code you are using so I can take a look?

Sure. Here it is:

global $freshbooks;

        $page = 1;
        $morePages = 1;
        while($morePages) {

            $current_page = $list->categories->{'@attributes'}->page;

            $total_pages = $list->categories->{'@attributes'}->pages;

            if($total_pages == 0) break;

            //Figure out if we need to continue the while loop onto the next page...
            if($current_page == $total_pages) {
                $morePages = 0;
            } else {
                $page = $page + 1;

            //Get the categories on this page of the pagenated list and loop over all of them...
            $categories_on_page = $list->categories->category;

            if(is_array($categories_on_page)) {

                foreach ($categories_on_page as $particular_category) {

                    $category_id = $particular_category->category_id;

                    if (strpos(strtolower($particular_category->name),'postage') !== false) {
                        $postage_category_id = $category_id;


            } else {
                $particular_category = $categories_on_page;

                $category_id = $particular_category->category_id;

                if (strpos(strtolower($particular_category->name),'postage') !== false) {
                    $postage_category_id = $category_id;


        $freshbooks->expense->category_id= absint($postage_category_id) ; // (Required) The ID associated with categories like Automobile, Contractors, etc
        //$freshbooks->expense->project_id=''; // (Optional) Related project as ID
        //$freshbooks->expense->client_id=1; // (Optional) Specifically assigned to this client
        $freshbooks->expense->amount= $shipping_price; // (Required) Associated cost
        $freshbooks->expense->vendor= $shipping_carrier; // (Optional) Associated vendor name
        //$freshbooks->expense->date=''; // (Optional) Applicable date
        //$freshbooks->expense->notes= $shipping_description;// . '[Box ID: ' . $box_id . ']'; // (Optional)

        //WHEN READY:

        $expense_id = $freshbooks->expenseCreate($staff_id);

Did you have a chance to look at this? I am desperate for an answer to this problem. As invoicing without generating expenses is no way to have balanced books.

Hello we bought your script on another account. I am trying to update a recurring profile using the code below:

$recurring_id = $_GET['id']; 
$freshbooks= new easyFreshBooksAPI();
$freshbooks->autobill->gateway='Authorize.net'; // Case insensitive gateway name from gateway.list (Must be auto-bill capable)
$freshbooks->autobill->card_name='John Smith';
$freshbooks->autobill->card_number='4111 1111 1111 1111'; // Can include spaces, hyphens and other punctuation marks
$recurring_id = $freshbooks->recurringUpdate($recurring_id);

But when i run the code below there is an error generated:

Message: Undefined property: easyFreshBooksAPI::$lines Filename: freshbooks/easyfreshbooks.class.php Line Number: 1182

I added the whole code to create a recurring profile but it did not work as well. No errors but no result as well.

Please help ASAP

Thanks and more power

BTW i also tried

    $msg = '  

Client with ID: '.$recurring_id.' successfully added!

'; }else{ $msg = '

'.$freshbooks->lastrequest.' an error : '.$freshbooks->error.'!

'; } echo "


but did not return any error or message.

Well the script is not working I have the URL and API key Set and it is still not pulling data

Can you send me your code to take a look?

    $freshbooks=new easyFreshBooksAPI();

are you sure client ID exists? can you do a “clientList()” to check it?

how can i return the invoice_id by doing a recurring create, i notice when you do a recurring it also creates an invoice?

how can get the invoice_id for that recurring being created?

I simply want to echo out a list of invoices for a client. When there is only 1 invoice it doesn’t work. How do I check how many invoices there are before running the loop?

$list=$freshbooks->invoiceList($filters, $page);
foreach($list->invoices->invoice as $invoice) {
echo $invoice->created_at;