The Netherlands international will move to the Bundesliga on a temporary basis after he was deemed surplus to requirements at Barcelona.
The Bundesliga side was eager to add some more creativity to its squad before the closure of the summer transfer window, and Goal.com exclusively revealed on Wednesday that it had opened talks with Barca over the transfer of the Netherlands international.
Negotiations continued on Thursday and Afellay has now completed his move after passing a medical on Friday morning.
Afellay joined Barcelona from PSV in January 2011, and played an important role in the Catalans' Champions League victory that season with an assist in the semifinal tie versus Real Madrid. Nevertheless, a serious knee injury kept him out of action for the majority of the 2011-12 campaign.
Barcelona coach Tito Vilanova recently revealed that Afellay was unlikely to play a big role at the Blaugranas this season, prompting the 26-year-old to seek a loan move in order to get regular first team action elsewhere.
Follow GOAL.COM USA on