Virtual power plants (VPPs) are emerging as a source of flexibility to the power systems because of their potential to provide a cost-effective solution in the real time to complement the power mismatch due to intermittent renewable energy generation and avoid expensive upgrades to the network infrastructure to meet the peak demands. These features of the VPPs best fit in the transactive energy environment. Since the VPPs are driven through the wholesale energy market, a two-stage transactive energy-based planning framework for the integrated VPPs in a co-optimised energy and ancillary services market is proposed in this study. At the first stage, during the day-ahead market, a co-optimised combined optimum schedule is obtained for the power system and the VPPs including the ancillary services. Flexible demand bids are proposed at this stage as a source of flexibility in the operation of the power system. At the second stage, a transactive energy-based real-time market balancing scheme is proposed. Furthermore, the proposed framework is validated on a modified 24-bus IEEE RTS and 118-bus IEEE power system with integrated VPPs. The simulation results show that the proposed approach results in a reduction of the locational marginal prices, congestion and reserve costs.