Candida ends with the lines:
MARCHBANKS (turning to her). In a hundred years, we shall be the same age. But I have a better secret than that in my heart. Let me go now. The night outside grows impatient.
CANDIDA. Good-bye. (She takes his face in her hands; and as he divines her intention and bends his knee, she kisses his forehead. Then he flies out into the night. She turns to Morell, holding out her arms to him.) Ah, James! (They embrace. But they do not know the secret in the poet's heart.)
The secret in the poet's heart is whatever you decide it is. It is worth noting that if you watch the play, it ends with Candida and James's embrace, not with the secret in the poet's heart, which is not even a stage direction, but simply an observation that may well be a Shavian joke.
Shaw, famously, did not much care for poetry. His friend and antagonist G. K. Chesterton compared him to Plato in his dislike of poets. Shaw deliberately makes Marchbanks an effete eighteen-year-old poet, exactly the type of person whose heart he would have dismissed as being full of romantic nonsense. Marchbanks believes that his experience with Candida has made him grow up. He says that the secret in his heart is better than the knowledge of their respective ages or the knowledge that this difference ultimately does not matter, as they will be equally dead in a hundred years. The most reasonable guess from the context would therefore be something about the survival of the spirit after death (with which Shaw would not have agreed) or the immortality of art (at which he would have been inclined to jeer when the art in question was Romantic poetry). Any explanation, however, is bound to be a guess, and I maintain that the most likely explanation of the secret is that it is a Shavian joke, designed to prompt ingenious and unlikely explanations.