Third baseman Matt Chapman and the San Francisco Giants have agreed to a $54 million, three-year contract, a person familiar with the negotiations told The Associated Press.

Chapman will get $20 million this year and can earn $18 million in 2025 and $16 million in 2026, the person said, speaking to the AP on condition of anonymity Saturday because the agreement had not been announced. Chapman has the ability to opt out after each season to become a free agent again.

The 30-year-old Chapman won his fourth Gold Glove last year and turned down a $20,325,000 qualifying offer from the Toronto Blue Jays on Nov. 14. Because Chapman turned down the qualifying offer, the Giants will lose their second-round draft pick and give up $500,000 from their international signing bonus pool. Toronto will get an extra draft selection after the fourth round.

Chapman batted .240 with 17 home runs, 39 doubles, 54 RBIs and a .755 OPS in 140 games. Toronto finished third in the AL East at 89-73 and was swept by Minnesota in their best-of-three Wild Card Series.

Chapman got off to a huge start, hitting .384 with a 1.152 OPS and 21 RBIs through the end of April, but he slumped most of the rest of the way, tailing off to .205 with five homers, 15 RBIs and a .663 OPS in the second half.

The right-handed hitter set career highs with 36 homers and 91 RBIs for Oakland in 2019, when he made his only All-Star team and finished sixth in AL MVP voting.