Visa, Mastercard and a number of U.S. banks have reached an agreement to pay $6.2 billion to settle a long-running class action suit brought by millions of merchants over card swipe fees.

The settlement was reached Monday among the parties in antitrust litigation that has run for 13 years, according to reports that Visa and Mastercard filed on Tuesday with the U.S. Securities and Exchange Commission.

The settlement agreement is still subject to approval by U.S. District Judge Margo Brodie of the Eastern District of New York.

Visa's share of the settlement payout is estimated to be about $4.1 billion, while Mastercard appears set to add $900 million, according to news releases from the companies.

“After years of thoughtful negotiation, we are pleased to be able to reach this agreement and move forward in our partnership with merchants to provide consumers convenient, reliable, secure ways to pay,” said Kelly Mahon Tullier, Visa's general counsel and executive vice president, in a news release.

“We are taking a significant step toward closing a chapter in a long-standing case,” said Mastercard general counsel Tim Murphy in a news release. “We can put this behind us and focus on continuing to innovate with our merchant partners to deliver the experience and convenience that consumers expect.”

Visa was represented by Robert Vizas in Arnold & Porter Kaye Scholer's San Francisco office; Mark Merley and Matthew Eisenstein from the firm's Washington, D.C., office; and Robert Mason from the firm's New York office.

Visa's legal team also included Holwell Shuster & Goldberg attorneys Michael Shuster, Demian Ordway and Blair Kaminsky.

Mastercard was represented by Paul, Weiss, Rifkind, Wharton & Garrison attorneys Kenneth Gallo, Zachary Dietert and Gary Carney.

The antitrust case began in 2005, when about 12 million merchants filed Sherman Act claims in the Eastern District against Visa, Mastercard and their issuing banks, arguing that rules set by card issuers' networks that impose artificially inflated fees violated the act.

The merchants claimed the credit card companies were being anti-competitive by imposing the “default interchange fee” that applies to every transaction in the network; the “honor-all-cards” rule that requires all stores to accept all Visa and Mastercards if they accept any of them; and “anti-steering” rules prohibiting merchants from charging different prices depending on the means of payment.

In 2012, the parties reached a $7.25 billion settlement in the case, which now-retired U.S. District Judge John Gleeson approved in 2013.

But in 2016 the U.S. Court of Appeals for the Second Circuit threw out the settlement, citing concerns that class counsel—which stood to rake in $544.8 million in fees—was representing two groups of plaintiffs that had competing interests.

The class counsel, led by Craig Wildfang of Robins Kaplan in Minneapolis with lawyers from Berger & Montague in Philadelphia and Robbins Geller Rudman & Dowd in San Diego, represented both a group of merchants who accepted cards before the settlement date and a group of merchants who would accept cards after the settlement date; the former group was set to receive the settlement money, while the latter would have received injunctive relief but none of the settlement.

In a written statement, Wildfang said that the settlement was the product of more than a year of work with two mediators. The settlement award could be reduced by up to $700,000 if opt-outs from the settlement reach a certain threshold, according to the statement.

Patrick Coughlin of Robbins Geller said in the statement that the parties agree that they have addressed the issues that the Second Circuit raised in its 2016 ruling.

Plaintiffs in the case had also been represented by New York attorney Gary Friedman, who also worked on massive antitrust litigation involving American Express.

During a criminal investigation into former Willkie Farr & Gallagher partner Keila Ravelo, who worked on the defense team for Mastercard, investigators found that Friedman and Ravelo were in communication regarding the cases, which led to another Eastern District judge to throw out a settlement reached between American Express and a group of merchants.

Read More: