Does Andersen ever use the “happily ever after” ending?

Literally, I can't think of a single happy ending in even one of his stories.

It always ends with death, disappointment, or apathy.

Andsersen has some happy endings, eg the Snow Queen or the Ugly Duckling. I guess the Matchstick Girl has the closest to a “happily ever after” ending, since she dies and goes to heaven.

Death usually is a happy ending in his stories. It's ascension to paradise and being freed from mortal suffering. It makes more sense if you're a deeply religious man from the 19th century than it does today, admittedly.

78% of the world population are religious today, per e.g. Statista.

Yeah but not every religious writer considers suffering and death a happy end.

Being religious is not quite the same thing as having a cultural frame of reference where death is a happy ending.