The role of cash in the U.S. economy is shrinking, thanks to technology that allows for so many other ways to pay for things.

American consumers used cash in 32% of all retail transactions in 2015, down from 40% in 2012, according to the Federal Reserve’s most recent survey of payment choices.

Cash accounted for just 9% of the value of payments...