This is not a question about whether traps should grant player experience, but should have an XP value for the purposes of adventure day planning. For example, should a runner with a dangerous trap be considered a difficult encounter?
It has the potential to use player resources, from healing potions to recover lost HPs to spells to avoid or disable it. On the other hand, there are no clear guidelines on the estimation of their difficulty; I am inclined to say: Setback = Easy / Medium, Dangerous = Medium / Hard, Deadly = Hard / Deadly, but that's just a hypothesis.
I have found this question (How do traps affect the design budgets of meetings?) But it is about adding traps in an encounter, not just having traps as an encounter (and it does not seem very accurate). There is also this (How should I grant XP for the traps?), With a suggestion to calculate a CR for a trap, but it is not obvious to me how that would be done. I suppose I could count only the offensive CR and assume that the damage is done in 3 rounds, but that also feels arbitrary.