On-demand streaming music is inevitable, so Spotify is taking whatever fuel it can get to win the race against Apple. Whoever can sign up customers faster to consume their data and network effect could earn money off them for a long, long time. So it makes sense that Spotify would be willing to raise money at ugly, exploitative terms now for a better chance at earning those riches later.

Today Spotify raised $1 billion in convertible debt from TPG, Dragoneer, and clients of Goldman Sachs, as first reported by Wall Street Journal’s Douglas MacMillan. By raising debt rather than equity, it doesn’t have to worry about poor signaling from a down-round raised at a lower valuation than the $8.5 billion it set in June 2015.

Spotify confirms the news is true, and TPG tells me “This financing gives them the strategic resources to further strengthen their leadership position.” The money will be spent on growth and marketing.

But here’s the catch.

If Spotify doesn’t perform well, some aggressive deal terms could cost it a lot of money.

TPG and Dragoneer get to convert the debt to equity at a 20% discount of whatever share price Spotify sets for an eventual IPO. And if it doesn’t IPO within the next year, that discount goes up 2.5% every extra six months.

Spotify also has to pay 5% annual interest on the debt, and 1% more every six months up to a total of 10%. And finally, TPG and Dragoneer can sell their shares just 90 days after the IPO, before the 180-day lockup period ends for Spotify’s employees and other investors.

This all could screw employees if Spotify has a bad year vs Apple Music, since the deal gives these late-stage investors cheaper shares and early sale advantages. Then again, employees’ stock is only valuable in Spotify succeeds, and it needs this cash to do so.

[Update: If Spotify can grow its value significantly and the IPO goes well, the discount and early sale terms won’t be that bad. Arguably, it’d be better than raising money with equity now that would be would worth a lot more later if Spotify does well.

A source familiar with Spotify’s finances tells me it still had €570 million still in the bank, so there was no gun to its head to raise this money. Apparently it wanted to raise through debt because it believes this year will go well.

What the debt does provide Spotify is opportunities to make acquisitions. With SoundCloud and Pandora in the dumps, Spotify could potentially make a play to bring more independent music or radio listeners into its music empire.]

Why would Spotify agree to these aggressive terms? Because it’s competing with the most well funded company in history: Apple.

Many people around the world don’t even understand that on-demand streaming exists. Companies selling it will have to undertake expensive advertising campaigns to educate consumers and sign them up before someone else does. They’ll also have to forge relationships and strike deals with top artists to get exclusive or early access to their music. Plus, having the money to potentially acquire other music companies like SoundCloud or Pandora could give Spotify a leg up in the fight.

None of that comes cheap, though. So Spotify signed a devilish deal.