There are anecdotal reports of people willingly being bound or whipped, as a prelude to or substitute for sex, during the 14th century.
John Cleland's novel Fanny Hill, published in 1749, incorporates a flagellation scene between the character's protagonist Fanny Hill and Mr Barville [REF].