We often forget that Scripture, especially New Testament Scripture, is written to address specific problems. So if we walk in late into the middle of a discussion of an ongoing issue, it's very likely we will miss out on what the problem is.
The background to this situation of Ananias is what follows baptism. The text records, in other places, a similar failure, with a few differences, by Simon the sorcerer. The latter was baptised on seeing the great works of God manifested through Philip's ministry.
Baptism into Christ is given when the candidate is motivated to express confidence that leaving selfish living to serve God through selfless living is a viable option, because God will reward such faith by rescuing when disasters resulting from selfless living occur, as well as recognise the believer as belonging to God, noted in the Book of Life.
Which in turn is how God makes a believer a blessing to the world, because when people see that believer living a selfless life and not suffering the inevitable consequences, they are also motivated to leave selfish living.
This mode of living a selfless life and not suffering the inevitable consequences, is called receiving the Kingdom of God.
Exodus 8 (NASB)
19Then the magicians said to Pharaoh, "This is the finger of God." But Pharaoh's heart was hardened, and he did not listen to them, as the LORD had said.
*
Luke 11:20 (NASB)
20But if I drive out demons by the finger of God, then the kingdom of God has come upon you.
*
John 3 (NASB)
1Now there was a man of the Pharisees named Nicodemus, a leader of the Jews. 2He came to Jesus at night and said, “Rabbi, we know that You are a teacher who has come from God. For no one could perform the signs You are doing if God were not with him.”
*
Matthew 19
7Then Peter said to Him, “Behold, we have left everything and followed You; what then will there be for us?” 28And Jesus said to them, “Truly I say to you, that you who have followed Me, in the regeneration when the Son of Man will sit on His glorious throne, you also shall sit upon twelve thrones, judging the twelve tribes of Israel. 29“And everyone who has left houses or brothers or sisters or father or mother or children or farms for My name’s sake, will receive many times as much, and will inherit eternal life.
*
Luke 12
32"Do not be afraid, little flock, for your Father has chosen gladly to give you the kingdom.
*
Luke 10
20“Nevertheless do not rejoice in this, that the spirits are subject to you, but rejoice that your names are recorded in heaven.”
*
Exodus 32
32Yet now, if You would only forgive their sin... But if not, please blot me out of the book that You have written."
*
Exodus 4
1Then Moses answered, “What if they refuse to believe me or listen to my voice? For they may say, ‘The LORD has not appeared to you.’”2And the LORD asked him, “What is that in your hand?” “A staff,” he replied. 3“Throw it on the ground,” said the Lord. So Moses threw it on the ground, and it became a snake, and he ran from it. 4“Stretch out your hand and grab it by the tail,” the LORD said to Moses. So he reached out his hand and caught the snake, and it turned back into a staff in his hand. 5“This is so that they may believe that the LORD, the God of their fathers—the God of Abraham, the God of Isaac, and the God of Jacob—has appeared to you.”
All Scripture references are from the NASB.
So we know what Simon the Sorcerer, Ananias and Sapphira were trying to obtain, without leaving serving mammon, and without learning what was required to pass the test of the Holy Spirit.