1Now a man named Ananias, together with his wife Sapphira, also sold a piece of property.
2With his wife’s full knowledge he kept back part of the money for himself, but brought the rest and put it at the apostles’ feet.
3Then Peter said, “Ananias, how is it that Satan has so filled your heart that you have lied to the Holy Spirit and have kept for yourself some of the money you received for the land?
4Didn’t it belong to you before it was sold? And after it was sold, wasn’t the money at your disposal? What made you think of doing such a thing? You have not lied just to human beings but to God.”
Ananias and Sapphira died because they lied about what they were giving to God's people. They didn't have to sell it to give and they didn't have to give it all, it was theirs at their disposal. But they said that they were giving it but didn't.
This is very much like the Pharisees law of Korbin which Jesus taught against because the person with the money would say that they were giving to God so they couldn't care for the parents, when in fact they still had it to do whatever they wanted to with it.