After months of bumpy courtship, SiriusXM Holdings (SIRI - Get Report) , the satellite-radio operator, agreed to buy a minority stake in Pandora Media (P) , the world's largest internet radio platform for $480 million, the companies announced on Friday.

As a result of the deal, which isn't expect to close until the fourth quarter, money-losing Pandora called off its earlier agreement with Kohlberg Kravis Roberts (KKR - Get Report) , the giant private-equity firm, for $150 million in financing. Pandora will pay KKR a $22.5 million break-up fee.

Pandora also said on Friday that it has sold its ticketing business, Ticketfly, to Eventbrite for $200 million. Pandora acquired the company in October 2015 in a cash-and-stock transaction valued at $450 million. After rising as much as 7%, Pandora shares were gaining 1.8% to $8.57, trimming its 2017 decline to 32%.

SiriusXM agreed to pay $480 million for newly-issued convertible preferred shares of Pandora, beginning with an initial purchase of $172.5 million of the stock. The shares will be convertible into common stock at a price of $10.50, a roughly 14% premium to Pandora's average stock price over a 2-day period prior to its closing price on June 9.

In exchange for its investment, SiriusXM will be given three seats on Pandora's board of director, including the commanding position of chairman.

The transaction ends months of jockeying between Pandora and Sirius in which executives of both companies sought to downplay the potential for a merger, with Greg Maffei, CEO of Liberty Media Corp, which controls SiriusXM, even criticizing Pandora CEO Tim Westergren's management choices.

Maffei questioned Pandora's decision to launch an on-demand music streaming product rather than concentrating on its core business of internet radio. Going head-to-head with Spotify and Apple (AAPL - Get Report) Music, Maffei intimated, was an act of folly. Rather conspicuously, Friday's announcement said the SiriusXM investment in Pandora is aimed at "opportunities to build on its position in the streaming radio business."

In fact, the press release doesn't even mention Pandora Premium, the on-demand service that Westergren launched in March after much fanfare. Last month, Pandora said last month it had attracted about 500,000 trial subscribers for Premium. Apple this week said it had over 27 million subscribers to its Music service while Spotify executives said earlier this year that they'd surpassed 50 million.

For SiriusXM, Pandora offers both a huge listener base and a service that can help it compete with Spotify and Apple Music as cars become more connected to wireless applications. Most listening to SiriusXM's satellite radio services occurs in cars, owing to its early partnerships with auto manufacturers to have its product pre-installed in new vehicles.

"Liberty Media has long recognized the strength of the Pandora brand and the opportunities in the ad-supported digital radio market," Maffei said in the announcement. "We are very supportive of SiriusXM's strategic investment."