New Jersey was on its way to requiring all Garden State retailers to take cash.

Then Amazon and Walmart got involved.

New Jersey lawmakers shelved a vote on advancing a bill Thursday that would prohibit retailers from refusing to accept cash. The measure was tabled before a Senate Commerce committee hearing after the retail giants and other stakeholders expressed concerns with the bill, said State Sen. Nellie Pou (D., Passaic), who chairs the committee and is sponsoring the legislation.

As technology gives consumers more ways to pay, including with their smartphones, some businesses have gone cashless to improve efficiency and reduce the risk of robbery, among other reasons.

But consumer advocates say cashless businesses effectively discriminate against poor customers who don't have access to credit or bank accounts, and seniors who aren't comfortable paying with plastic or digital devices.

The bill would make New Jersey the second state to ban cashless businesses and the first since 1978, when Massachusetts passed a law requiring merchants to accept cash.

The New Jersey Assembly overwhelmingly approved the bill in June by a 71 to 4 vote. The legislation won't come back before the Senate Commerce committee until December, Pou said.

"We believe that during this particular time we hope to be able to work with a number of different groups in coming up with various other possible options that will help the unbanked population," Pou said when announcing that the bill would be tabled.

Amazon has one cashless bookstore inside the Garden State Plaza mall in Paramus, Bergen County. The company also has four "pop-up" retail locations inside New Jersey malls that all take cash.

Amazon, which is considering Newark and Philadelphia for its second headquarters, declined comment.

The web giant has launched retail locations in Seattle that allow consumers with an "Amazon Go" app to grab items they need and leave without checking out. The stores can detect when products are taken from shelves and add them to a virtual cart, according to Amazon. After the customer leaves, Amazon charges the user's online account.

Walmart has also tested the waters on letting customers scan and pay for items on their smartphones, but ditched the idea in May, according to reports. Walmart did not return a request for comment.

"If we legislate against it, then that affects their current business," Pou said of cashless retailers after the hearing. "I want to be mindful of how we do something that addresses both sides."

A few businesses in the Philadelphia area have gone cashless in recent years, perhaps most notably Sweetgreen, the salad restaurant chain that has six locations in Philadelphia and the King of Prussia mall. Bluestone Lane, a coffee shop chain with two locations in the region, went cashless in 2016. Both companies declined requests for interviews.

"There hasn't been any negative reaction to the rollout," Bluestone Lane marketing director Andrew Stone wrote in an email. He said the benefits of being cashless include not needing armored trucks to deliver cash and no requirement to balance cash when closing business for the night. "And local communities like it as we're also 100 percent tax compliant," he added.

The Franklin's Table food hall that opened in March at the University of Pennsylvania has four cashless lunch spots.

New Jersey Assemblyman Paul Moriarty (D., Gloucester), who introduced the cashless business ban bill, said there are social and privacy issues with retailers refusing to accept cash.

"I think U.S. currency should be accepted at retail establishments," said Moriarty. "Even if the number of people using cash dwindles significantly, they should allow for cash for these people who are marginalized — the elderly, the youth, and people that are poor. They need to buy stuff too."

He added that consumers are increasingly aware that retailers and tech companies are tracking their movements and spending habits, so they may prefer the privacy that comes with cash.

His bill would require all brick-and-mortar retailers in the state to accept cash, excluding transactions made online, by telephone, or by mail. Businesses could receive a $2,500 fine for a first offense and $5,000 for a second violation. Subsequent offenses would be considered unlawful practices under the consumer fraud act, which can levy penalties of up to $20,000.

The use of paper bills has declined in recent years. In October 2016, 31 percent of payments were made with cash, compared to 40 percent in 2012, according to surveys by the Federal Reserve Bank of Boston, though the fed cautioned that it modified its methodology during that time. Twenty-seven percent of payments were with debit cards and 18 percent were made through credit cards in October 2016, the most recent data available.