San Diego will pay St. Louis $7.5 million to cover part of the $33 million remaining on Gyorko's contract.
The 27-year-old Gyorko hit .247 with 16 homers and 57 RBIs this year, spending time at second base, shortstop and first base. He has a .236 average in three big league seasons with 49 homers and 171 RBIs.
Under a deal Gyorko signed in April 2014, he is guaranteed $4 million next season, $6 million in 2017, $9 million in 2018 and $13 million in 2019. The contract includes a $13 million club option for 2020 with a $1 million buyout.
San Diego agreed to pay the Cardinals $2.5 million each of July 1 in 2018 and 2019, and an additional $2.5 million on Sept. 1, 2019.
Jay, 30, helped the Cardinals win the 2011 World Series title but hit .210 last season, his lowest average in six big league seasons and down from .303 in 2014. He has a .287 career average.
Jay has a $6,225,000 salary next season, then can become a free agent.