AC Milan have extended the contract of goalkeeper Gianluigi Donnarumma until 2021, weeks after the 18-year-old turned down their offer of a new deal.
The Rossoneri announced on Tuesday evening that the 18-year-old had had a change of heart and agreed to extend his previous deal, which was due to expire in 2018.
Reports in Italy said the deal was worth €6 million per year net, and includes a release clause in excess of €70m, or less if Milan fail to qualify for the Champions League.
When Raiola ended talks with Milan last month, sources told ESPN FC that the agent wanted a €40m release clause while Milan would only accept a clause in the range of €100m.
Donnarumma, who became the Italy national team's youngest-ever goalkeeper, is set to become the third highest-earning goalkeeper in Europe, at €2 million a year more than Juventus and Italy No. 1 Gianluigi Buffon.
He had been on an academy contract up until signing his new agreement, despite having played 68 times already in Serie A.
"In the end, the Club and the goalkeeper have reached an agreement to extend Gianluigi Donnarumma's contract," read a statement on Milan's website. "Surely positive news for AC Milan who have worked hard to renew the keeper's contract, for the player and the fans. Therefore, Gigio's experience in the Red and Black continues.
"AC Milan will be holding tight on one of the most talented players in the squad with the class of '99 who will be part of the backbone of the Red and Blacks in the new season. Pure class and talent that will continue to defend AC Milan's goal ready to help the Rossoneri in the race for the Champions League."
Donnarumma's initial refusal to commit to a new deal upset Milan fans, with many blaming his agent Mino Raiola for trying to lure him away from the Serie A club in order to earn a substantial fee for his services. Buffon had backed Juventus to sign Donnarumma as his eventual successor, and Raiola said that 11 top clubs were interested in the young stopper.
But fake dollar bills were then thrown at the player during one of Italy's European Under-21 Championship matches in Poland, with a banner naming him "Dollarumma" also exposed.
After the tournament, Donnarumma skipped his school-leaving exams to go on holiday in Ibiza with his girlfriend, receiving further criticism. In a bizarre sequence, Donnarumma vowed to resume talks, only to late claim his social media account had been hacked.
The player then met with Raiola in Ibiza while Milan management were also in daily contact, leading to Tuesday's announcement that he had, indeed, extended his contract until 2021.
His older brother, goalkeeper Antonio Donnarumma, is also reported to have joined Milan as part of the overall agreement, making him the club's eighth new arrival this summer after moving from Asteras Tripoli.