New York: Visa Inc. and Mastercard Inc. agreed to pay up to about $6.2 billion to end a long-running price-fixing case brought by merchants over card fees.

The lawsuit has been one of many flashpoints in the battle between retailers and financial firms over the $90 billion that US merchants spend every year on swipe fees. Visa, Mastercard and various financial institutions will pay $900 million in addition to about $5.3 billion agreed under a 2012 settlement, according to a filing.

Visa and Mastercard had previously set aside $5.3 billion with the court to settle the claims. Earlier this year, as the two sides drew closer to an agreement, Visa and Mastercard put aside an additional $600 million and $300 million, respectively, to help cover the settlement amount.

The dispute began in 2005, when Visa and Mastercard were still owned by banks. Merchants had accused them of violating antitrust laws by illegally inflating swipe fees, or interchange, that merchants pay on every purchase transaction and which banks use to fund consumers’ credit-card rewards. The two payments networks have since gone public—Mastercard in 2006, and Visa in 2008—and their shares have soared.