David Price teed off Tuesday morning at a charity golf tournament in Las Vegas believing he would be spending the next seven years pitching for the St. Louis Cardinals.

By the time he left the event hosted by former major leaguer Wally Joyner, Price had agreed to become a member of the Boston Red Sox with a deal that will make him the richest pitcher in history.

Price has agreed to a seven-year, $217 million contract with the Red Sox, a person directly involved in the negotiations told USA TODAY Sports. The person spoke on condition of anonymity since the deal won’t become official until Price passes a physical Thursday evening. Price is expected to be introduced at a press conference on Friday in Boston.

The contract, which was first reported by the Boston Globe, includes no deferred money, with an opt-out clause after the 2018 season. Price will be paid $30 million a year for the first three seasons, and will then receive annual salaries of $31 million in 2019, and $32 million from 2020 through 2022.

Price, one of top pitchers on the market with Zack Greinke, was ready to sign with the Cardinals, but then the final push began.

The Red Sox were also in negotiations with Greinke, according to a high-ranking team official who asked not to be identified due the sensitive nature of negotiations.

Greinke’s representative, Casey Close, told Red Sox president Dave Dombrowski that he wanted an answer by Tuesday night on whether the team would agree to Greinke's contract proposal. Greinke is also being courted by the Los Angeles Dodgers and San Francisco Giants.

Dombrowski, wanting to make sure that he would land one of the two pitchers, then went to Price's agent, Bo McKinnis, early Tuesday with an increased offer and said the Red Sox needed a decision from Price by Tuesday night.

The Cardinals were also in the hunt for Price, and offered him the richest contract in franchise history, a seven-year deal worth at least $30 million less than the Red Sox's offer. And the Chicago Cubs met with Price but never made a formal offer, according to the person directly involved in the negotiations.

Price’s deal, which is $2 million more than the Dodgers gave ace Clayton Kershaw in January 2014, easily dwarfs the largest deal for a pitcher in Red Sox history. The highest previous contract was a four-year, $82.5 million extension given to Rick Porcello in April.

Price, 18-5 with a 2.45 ERA last season, who finished second to Dallas Keuchel of the Houston Astros in the AL Cy Young voting, certainly has the credentials to be the highest-paid pitcher. He is a five-time All-Star and 2012 Cy Young winner, who has thrown 1,299⅓ innings the past six seasons, the fourth most in baseball. He joins a rotation that yielded a 4.39 ERA last season, the third highest in the AL.

Price, in reaching the deal, rejoins Dombrowski, who was president of the Detroit Tigers until he was fired in August. Dombrowski traded for Price from Tampa Bay in July 2014 and, in one of his his final moves with the Tigers, traded away Price to the Toronto Blue Jays a year later.

Price, a native of Murfreesboro, Tenn., was enamored with joining the Cardinals, who have reached the postseason the last five seasons, with two pennants and a World Series title. Yet, the Red Sox’s offer simply was too strong for him to refuse.

Now, unless he opts out of his contract or is traded, Price has a chance to become the first starting pitcher to spend his entire career in the American League in the DH era and reach the Hall of Fame.

And if he opts out, well, the Cardinals and Cubs will be there waiting again.