Adding Square to simple invoices on SimpleInvoices

I love the website application SimpleInvoices (I did not code it), I dislike invoicing through Excel as I did in the past, because I needed to physically be at my desktop computer, and complete too many steps to send it. SimpleInvoices is a great tool because once the “Biller” (your company) and the “Customers” (your clients) are recorded into the database, completing the invoice and sending it off can be completed on your phone in just a few clicks. Seriously, like 30 seconds of work, and no stupid mobile app to deal with.

The problem with SimpleInvoices (IMHO) was that it was written in 2008, a time period with fairly limited payment options. While the script includes options for PayPal and eWay, it doesn’t include options for Square or LevelUp.
Most of these convenient payment gateways offer some type of URL for fast cash transactions. For instance the URL for Square’s service is*yourusername/*amount
*variables to be filled in by you
It took me a couple of hours, but I found the script that generates the PayPal button on the invoice and made it generate the Square button nearby with a link to my site (square creates it when you install the Sqaure Cash app).
The file to edit can be found in your SimpleInvoices installation in the templates/invoices/default/plugins directory, and is named function.online_payment_link.php .
Once you find the directory, you should make a nice looking button in your favorite photo editor or graphics program, the PayPal button is 150×52 px in size. Making the buttons roughly match in size and shape might be nice. Feel free to use the one I made, it has the rounded corners similar to the PayPal button that comes with SimpleInvoices.
You need to upload the button you make to images/common directory inside of your SimpleInvoices installation.
Here is the code you need to paste into the  function.online_payment_link.php file, right after the “echo $link;” line:
$link2 = “<a href=’*yourusername/”.urlencode(number_format($params[‘amount’], 2, ‘.’, ”)).”‘><img style=’margin-left:10px;’ border=’0′ src=’”.urlsafe($url).”/images/common/pay_with_square.gif’/></a></div>”;
echo $link2;
Once your paste this line of code in, save function.online_payment_link.php. Now go build a phony invoice and check and make sure the link works.

Leave a Reply

Your email address will not be published.