by Jacob Allred | Mar 18, 2014 | Tips
The Infusionsoft API is powerful, but it occasionally lets you do things that you really shouldn’t do. For this tip I’m going to talk about creating invoices that include fractions of cents. This situation most often occurs when calculating discounts or adding sales tax in your own code, and then creating the invoice via the API. For example, you may have a product that retails for $99.99. If you discount this amount by 25%, then the product will cost $74.9925. The Infusionsoft API allows you to create an invoice for this amount, even though it contains fractions of cents that you won’t be able to collect. In Infusionsoft the order would look like this: If you use the API’s calculateAmountOwed method, you’ll find out that Infusionsoft is expecting a payment of $74.99. If you take a payment for $74.99, the order will look like this in Infusionsoft: Looks good, right? The invoice has a $0.00 balance. There isn’t any red text indicating an unpaid balance. If you use the API’s calculateAmountOwed method, Infusionsoft will tell you that $0.00 is owed. But what if you pull the invoice up in Infusionsoft? The Pay Status shows UNPAID in Infusionsoft. Pulling up the invoice via the API also shows a PayStatus of 0, which indicates that the invoice isn’t paid even though TotalDue (74.99) – TotalPaid (74.99) = 0! The moral of the story is never create invoices with fractions of cents. You should always round the invoice amount to the nearest cent before saving the invoice to...
by Jacob Allred | Mar 11, 2014 | Tips
The Infusionsoft API makes it possible to place orders and charge credit cards without your customer ever visiting a single Infusionsoft page. To do this, you’ll need to know your merchant account ID. Infusionsoft doesn’t provide a way to get this via the API. You can get it through your Infusionsoft app, but this involves clicking through to the right screen and then dissecting a page’s URL. An easier solution, especially if you are building software for clients, is to try to find this information by looking at recent transactions. By looking at recent transactions in the CCharge table, you can find the merchant account ID with a fairly high level of confidence. It is still a good idea to confirm your merchant account ID by looking in Infusionsoft but this helps you know you are looking in the right place. This code assumes you are using the free Novak Solutions Infusionsoft PHP SDK and you have a config.php with your app name and API key. <?php // Include the SDK require_once('Infusionsoft/infusionsoft.php'); // Query for recently used merchant IDs $charges = Infusionsoft_DataService::queryWithOrderBy(new Infusionsoft_CCharge(), array('Id' => '%'), 'Id', false, 100, 0, array('MerchantId')); // Loop through $m = array(); foreach($charges as $charge) { if(!isset($m[$charge->MerchantId])) { $m[$charge->MerchantId] = 1; } else { $m[$charge->MerchantId]++; } } if(!empty($m)){ // Find the most used merchant ID $max = array_keys($m, max($m)); $merchantId = $max[0]; } else { $merchantId = false; } // $merchantId = the most used merchant ID from the most recent 100 transactions We use this code in the free Infusionsoft One-click Upsell plugin for WordPress to make it easier to find your merchant account...
by Jacob Allred | Mar 4, 2014 | Tips
Adding Facebook comments to your web form can increase your conversions dramatically. For example, you might have a web form to sign people up for a webinar. Having a Facebook comment box gives your visitors the chance to leave positive comments about past webinars they’ve attended, or to express their excitement over the upcoming webinar. This social proof can provide the extra push that some visitors need to convince them to provide their personal information. Unfortunately, you can’t just copy and paste the Facebook comments code into your web form. Infusionsoft sanitizes any HTML or JavaScript that you put on a web form, rendering the pasted code useless. Luckily for you we’ve come up with a workaround. The first step is to create a Facebook app if you don’t already have one. It is common to name the app after your business or organization. For example, our app is named Novak Solutions. You’ll also need to go to settings and add a platform. Choose website. Enter your organization’s domain name for the site URL, and your Infusionsoft app URL for the mobile site URL. Then add both domains to the App Domains box. Click Save Changes. This will give you permission to use Facebook comments on your website and on hosted web forms. Finally, go to the Status & Review page and click the button to make your app available to the public. Next, we need to add some code to our web form. Add an HTML snippet with the following contents: <script src="//s3.amazonaws.com/novaksolutions/free/facebook-comments.js"></script> <script> jQuery(document).ready(function(){ addFacebookComments('277515279073217', 'https://joey.infusionsoft.com/app/form/fa967baed77e42caecdf30e7c389a92d', 5, 'light'); }); </script> There are a few parameters: 277515279073217 — Replace...
by Jacob Allred | Feb 25, 2014 | Tips
Custom dropdown fields in Infusionsoft let you specify a fixed set of options that must be selected from. For example, you could be creating an email preferences center and want to have a dropdown with Yes and No as the only options as to whether a contact is subscribed to a newsletter. Unlike the other custom field types, a dropdown allows you to select a default value. For a newsletter, you’d probably select No as the default value and only change it to Yes when a contact subscribes. The default value isn’t as straightforward as you might think. For example, if you add a new dropdown field and set the default value to No, Infusionsoft will show No for every contact when you pull up their record in Infusionsoft. Great! That is exactly what we’d expect. But what if you search for contacts that have No as the value for that field? You’ll get zero results. Even though each contact has No as the default, your app’s database doesn’t have any value for the custom field until you explicitly set it. Even if you create a new contact directly inside of Infusionsoft, the custom field won’t be set to the default value (unless you view the field before saving). This can have a huge impact on reporting and searching. Unfortunately there is only one good workaround for this issue. Let’s assume you want to send a broadcast to all of your contacts that have Yes for Holiday Specials and No for Weekly Promos. Perhaps you sent a special offer to the Weekly Promos group and now you want to send the same offer to Holiday Specials subscribers that didn’t already get the promo in the Weekly...
by Jacob Allred | Feb 18, 2014 | Tips
Update 7/1/2014: Infusionsoft has updated their version of jQuery to 1.10.2. This tip has been updated to accommodate this change. It is often helpful to provide links to external content in your shopping cart or order form, like the terms of a money back guarantee or a YouTube video. This extra content can help reassure your customers about their purchase or provide a demonstration of the product. But we all know that if a customer leaves your shopping cart, they might never come back! A solution to this is to show your content in a lightbox. Instead of leaving your cart, the link will open in a modal dialog within the shopping cart page. There are dozens of great jQuery plugins that provide lightbox functionality. Unfortunately, Infusionsoft uses an extremely outdated version of jQuery (v1.6.2 released June 30, 2011). It works great for DOM manipulation, but it isn’t compatible with the latest and greatest lightbox plugins. To get around this problem we modified a copy of jQuery v1.11.0 to work under a different name, jNew. We also modified an excellent lightbox plugin, Magnific Popup, to work with jNew instead of jQuery. We are hosting both of these modified libraries on a CDN that you are welcome to use. For this example I’m going to use an order form. You can easily use this code on a web form or shopping cart. First, you need to add the required libraries to your HTML custom header: <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.9.9/magnific-popup.css"> <script src="//cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.9.9/jquery.magnific-popup.min.js"></script> Next you need to add your link to the page. You can put it anywhere you want. For this example, we...