Now when the apostles who were at Jerusalem heard that Samaria had received the word of God, they sent Peter and John to them, 15 who, when they had come down, prayed for them that they might receive the Holy Spirit. 16 For as yet He had fallen upon none of them. They had only been baptized in the name of the Lord Jesus. 17 Then they laid hands on them, and they received the Holy Spirit.
18 And when Simon saw that through the laying on of the apostles’ hands the Holy Spirit was given, he offered them money, 19 saying, “Give me this power also, that anyone on whom I lay hands may receive the Holy Spirit.”
20 But Peter said to him, “Your money perish with you, because you thought that the gift of God could be purchased with money! 21 You have neither part nor portion in this matter, for your heart is not right in the sight of God. 22 Repent therefore of this your wickedness, and pray God if perhaps the thought of your heart may be forgiven you. 23 For I see that you are poisoned by bitterness and bound by iniquity.”
24 Then Simon answered and said, “Pray to the Lord for me, that none of the things which you have spoken may come upon me.”
25 So when they had testified and preached the word of the Lord, they returned to Jerusalem, preaching the gospel in many villages of the Samaritans. — Acts 8:14-25.
When Simon the ex-sorcerer sees that through the laying on of the apostles’ hands the Holy Spirit was given, he seeks to buy this power from them.
Peter rebukes him saying that his money may perish with him because he thought that the gift of God could be purchased! He further tells him he is neither part nor portion in this matter, for his heart is not right in the sight of God. He calls on Simon to repent of his wickedness, and pray that God may forgive him.
Simon tells the apostles to pray to the Lord on his behalf so that he may not be punished.
After testifying and preaching the word of the Lord in many villages of the Samaritans, the apostles returned to Jerusalem.