Shares of Square (SQ -1.86%) are trading around 10% off the all-time high they reached after the company reported fourth-quarter earnings last month. The company reported stellar results in 2016 and provided better-than-expected guidance for 2017. In fact, some analysts believe Square is being too conservative with its guidance.

Square is hitting all the right angles, and it's finally dropped the deadweight of its Starbucks (SBUX 0.42%) deal. 2017 is shaping up to be Square's best year yet, and the long-term outlook for Square looks great, as well. Shareholders have nothing to worry about.

Square dashboard on smartphone and laptop.

Image source: Square.

Starbucks deal grinds to a halt

Square signed a deal with Starbucks back in 2012. In exchange for a $25 million investment, Square cut Starbucks a deal on its payment-processing service. Unfortunately, things didn't work out well for Square.

Over the life of the relationship, Starbucks' business produced a negative gross margin for Square. In fact, it lost more more than three times as much in gross profits as Starbucks invested in the company. Only after the two companies renegotiated their deal in late 2015 did Square get some relief. And that's when Square saw its margins soar.

Square completely ended its relationship as a payment processor for Starbucks in the fourth quarter. Square's gross profit margin climbed more than 7 percentage points year over year in the fourth quarter. Investors should expect gross margin to remain elevated now that Square has eliminated one of the biggest drags on its profits.

Square's new products are a hit

Another significant factor driving higher gross margin for Square is its newer products. Last quarter, management made a point that products created since 2014 generated 25% of adjusted revenue in the fourth quarter. That's particularly noteworthy because products like Invoices, Instant Deposit, and Square Capital produce higher gross margins than Square's core payment-processing business.

Additionally, the marketing costs on these products are relatively low since Square sells them to merchants that are already Square customers. Therefore, the incremental revenue produces overall higher operating margins, as well.

As Square's new products account for a larger percentage of revenue, Square investors should see a larger percentage of revenue fall to Square's bottom line.

Square has tons of leverage left

Square CFO Sarah Friar expects the company's adjusted EBITDA margin to expand about 5 percentage points in 2017. She also sees margin expansion at that cadence for the foreseeable future.

While Square could theoretically boost margins much higher this year, it plans to reinvest a lot of its profits into growing the top line. Square sees a strong return on investment from its marketing dollars. Even as it expands to larger merchants, it's still taking an average of four to five quarters for Square to break even on its sales and marketing spend for each cohort of merchants it brings into its ecosystem.

As long as that payback period remains stable, Square should continue investing in sales growth, especially considering its success upselling merchants to higher-margin products. As sales grow, investors should see leverage in the company's general and administrative expenses. Down the road, Square could take its foot off the pedal with marketing, and see significant EBITDA margin expansion.

Overall, Square is sitting in a good position. It's no longer getting roasted by that bitter Starbucks deal, and it's managing margin expansion to prioritize the overall growth of the company. Investors have nothing to worry about.