Starbucks (NASDAQ:SBUX) already has one of the most impressive customer loyalty programs of any restaurant or retailer.

Now tied to its mobile app, the My Starbucks Rewards Plan offers customers "stars" for every item they purchase. Earn 12, and you get a free drink. The program has a few other perks, but mostly it boils down to a fancy version of one of those punch cards, where enough holes gets you a free sandwich.

The company has built the program by not only expanding it to retail outlets beyond Starbucks' own stores, but by tying it to the mobile app. Available on Android phones and Apple iPhones (but not Microsoft Windows Phones), the app not only tracks the rewards earned, it offers the ability to pay. Those features lured "a record 1.3 million new My Starbucks Rewards members in Q2, bringing total active membership to 10.3 million," the company reported in its second-quarter earnings release.

Those are impressive numbers, and they may be about to get better as the company, which has dabbled in music through the rewards program by offering free songs through its app, has made a deal with Spotify to integrate the music service into its app and its stores.

What are Starbucks and Spotify doing?
press release explained that the two companies have signed a deal:

[...] to establish a multi-year relationship that will link its 7,000 company-operated stores in the U.S. and 10 Million My Starbucks Rewards loyalty members with Spotify's more than 60 Million global users to offer a first-of-its-kind music ecosystem.

That will allow MSR members to use Spotify to influence in-store playlists and, more importantly, will allow paying Spotify members to earn what the companies are calling "Stars as Currency."

According to the release, this is the first time Starbucks' loyalty program stars can be accessed by a third party for the benefit of Starbucks MSR members and Spotify users, though the release did not specify how many stars subscribers would earn. Starbucks customers currently receive a star when they pay with a registered card or via the mobile app at a participating store, or from specially marked Starbucks products at grocery stores, the company said on its website.

It takes 12 stars to earn a free drink in the Starbucks app. 

The deal means Starbucks, which announced plans to stop selling CDs in its stores earlier this year, is essentially letting Spotify take over its in-store music. As part of the deal, 150,000 U.S.-based Starbucks employees will also receive a Spotify Premium subscription, followed soon by workers in Canada and the United Kingdom. Those "partners," as the chain calls its workers, will be able to "shape the in-store music programming using tools provided by Spotify," said the release. These partner-influenced playlists will then be accessible on Spotify via the Starbucks Mobile App so customers can stream the music from their mobile devices at a later time.

"We plan on building one of the most robust digital ecosystems of any retailer in the world," said Starbucks COO Kevin Johnson. He continued:

Given the evolution of the music industry and the proliferation of streaming technology, it was natural that we would partner with Spotify in offering our customers a new way to engage with their favorite music.

Why does this matter?
Music has always been a key part of the Starbucks experience, and the company needed a replacement for selling and producing CDs to continue that commitment. This relationship modernizes the brand's approach to music while offering a new potentially valuable way to get people engaged with My Starbucks Rewards.

The company has not specified how many stars Spotify subscribers (who pay $10 a month for an individual subscription) will get. But, since the company currently offers three months for $0.99 as a promotion to entice users, it's possible it could be quite generous.

If you assume Spotify pays the cost of the rewards, but gets a wholesale price from Starbucks, offering a free beverage each month for six months of a full-price subscription would likely cost less than the $29 it loses on the 3 for $0.99 promotion. With an average cost-per-beverage of around $4.30 in 2014, according to Forbes, even if the music service pays full-price for six drinks, it would still be at $25.80. And, of course, if Starbucks carriers some of the cost, the numbers get even better.

That deal only makes sense as a way to lower new customer acquisition costs, but it's an example of how it can help Spotify while driving customers to Starbucks and its loyalty program.

For Starbucks, this serves as a test program for using other brands to draw customers into its stores. Imagine earning stars for buying groceries, going to the movies, or subscribing to an OTT service. The possibilities are endless, and they could all help the chain make its loyalty program even more attractive.