Acts Chapter 4 closes by making the statement that the Christian believers in the early Church considered their possessions to be their own, "but they had all things in common," and that a church member, Barnabas, sold a plot of land and donated the profit to the apostles. It was in this context that Ananias and Sapphira decided that they, too, would like to make such a donation. After the sale they agreed only to give a certain proportion of the money to the apostles, but to say that it was the whole amount.
In Acts 5:2, Ananias presents his donation to Peter, who replies, "Why hath Satan filled thine heart to lie to the Holy Ghost?" Peter points out that Ananias had every right not to sell the land at all or to do what he wanted to with the profits, but by telling a lie "by saying that he was donating the entire amount " he had lied to God.
Ananias then falls to the ground dead and is carried out. Three hours later, his wife enters and tells the same lie, suffering the same fate.