Amazon has agreed to pay $2.5 billion to resolve a Federal Trade Commission lawsuit alleging the online retail giant tricked customers into signing up for its Prime memberships and made it exceedingly difficult for them to cancel after doing so.

The Seattle-based company will pay a $1 billion civil penalty and give $1.5 billion in refunds to consumers who were harmed by their enrollment practices, the agency announced on Thursday.

The surprise settlement was announced days after a trial began in U.S. District Court this week. At the center of the case was the Restore Online Shoppers’ Confidence Act, a 2010 law designed to ensure that people know what they’re being charged for online.

FTC officials said the consumer refund amount exceeded even the agency’s expert projections, while Am

See Full Page