Taylor Swift Secretly Wrote Ex Calvin Harris' 'This Is What You Came For' Featuring Rihanna

This video is unavailable because we were unable to load a message from our sponsors.

If you are using ad-blocking software, please disable it and reload the page.

If you've been jamming out to Calvin Harris' "This Is What You Came For" featuring Rihanna, well, you can thank Taylor Swift!

The 26-year-old pop star is the creative mastermind behind the hit song. She penned the track and used the pseudonym Nils Sjoberg in the credits, her rep confirmed to ET on Wednesday.

WATCH: Taylor Swift Is Officially the Top-Earning Celeb of 2016!

The song was released on April 29 and instantly climbed the charts, reaching No. 4 on the Billboard 100 and No. 1 in the Dance/Electronic category. At the time, Swift was still dating Harris, and had no problem giving the catchy tune her stamp of approval via Instagram.

"OMG," she captioned the photo, which has since been deleted, of the song's cover art. She also rocked a jacket displaying the visuals at the Coachella Valley Music and Arts Festival in Indio, California, that same month, where Harris and Rihanna performed their 2011 song, "We Found Love," together.

NEWS: Calvin Harris Praises 'Fantastic' Taylor Swift

But now, Swift reportedly feels disrespected by the DJ/producer. A source tells ET that "during their relationship, Taylor wrote the song, sat down at a piano and did a demo into her iPhone."

The Nashville native sent the song to Harris, who apparently loved it. "They both went into a studio and did a full demo with Taylor on vocals and Calvin doing the beat," the source added. "They both knew the song would be a hit, but Taylor wrote it for Calvin and [they] both agreed it was a bad idea to let the world know they collaborated as a couple -- it would overshadow the song."

During an interview with Ryan Seacrest in April, Harris denied any desire to collaborate with the "Into the Woods" singer while promoting his new single.

WATCH: Calvin Harris & John Newman Release Breakup Song 'Ole' -- Is It About Taylor Swift?

"You know, we haven't even spoken about it," he said about mixing business with pleasure. "I can't see it happening though. No. She's about to take a long break."

Watch the full interview below.

Swift and Harris, 32, called it quits in June, just two months after celebrating their one-year anniversary.

WATCH: Taylor Swift and Tom Hiddleston Enjoy Romantic Date Night in Australia

Swift has since moved on with actor Tom Hiddleston, and the couple has been keeping their whirlwind romance alive by traveling the world. The two were spotted packing on the PDA during recent trips to Nashville, London, Rome, Rhode Island and Australia, where Hiddleston is currently filming Thor: Ragnarok.

To hear more on how their love story came to be, watch the video below.

Related Gallery