New York City’s restaurants and other retail establishments will no longer be allowed to reject cash payments under legislation passed by the City Council on Thursday.

Supporters of the bill say cashless businesses requiring credit cards and electronic payments like Apple Pay discriminate against poor people who may not have bank accounts or credit cards — as well as minors.

“The City of New York cannot allow the digital economy to leave behind the 25 percent of New Yorkers who are chronically unbanked and underbanked,” said Councilman Ritchie Torres (D-Bronx), the bill’s sponsor.

The legislation, which was approved 43-3, also prohibits businesses from charging cash-paying customers a higher price than those using credit.

The bill is also backed by Mayor Bill de Blasio and is expected to become law in nine months.

It is expected to put a severe crimp in the operations of no-cash chains Dos Toros and By Chloe.

Violators would face fines of up to $1,000 for a first offense and up to $1,500 for additional violations.

Similar bans already exist in other parts of the country, including Philadelphia and San Francisco.

The three council members who voted against the bill were Staten Island Republicans Steve Matteo and Joe Borelli and Brooklyn Democrat Kalman Yeger.