A small wooden box arrives on the doorstep of a married couple, who know that opening it will grant them a million dollars and kill someone they don't know.
(I'm sure it was "pressing the button" ... maybe that's the book version I read?)
So they take the box apart and decide that it doesn't contain anything so can't really harm anyone, and they press the button.
The creepy guy who left it returns, notes that they have pressed it (it's a test) and as he's leaving says "I'll give this box to someone else ... someone who doesn't know you"
Yes, the person who dies is the previous owner of the box. If you refuse to press the button, you save yourself.
Everyone fails the test.
The 80's "Twilight Zone" adaptation episode plays out like you describe. The original story is more darkly funny.
In the original short story, the plot is resolved differently. Norma presses the button, and receives the money—after her husband dies in a train incident where Arthur is pushed onto the tracks (the money was the no-fault insurance settlement, which is $50,000 instead of the $200,000 in the Twilight Zone episode). A despondent Norma asks the stranger why her husband was the one who was killed. The stranger replies, "Do you really think you knew your husband?"
Matheson strongly disapproved of the Twilight Zone version, especially the new ending, and used his pseudonym Logan Swanson for the teleplay.