title_body: Where is the returning Contract Monad in the handleError function of Contract Monad?
upvoted_answer: Definitions:
  submitTx :: forall w s e. (HasWriteTx s, AsContractError e) =&gt; TxConstraints Void Void -&gt; Contract w s e Tx
  void :: Functor f =&gt; f a -&gt; f ()
  handleError :: (e -&gt; Contract w s e' a)-&gt; Contract w s e a -&gt; Contract w s e' a
  Explaination:
  submitTx tx is of type Contract w s e Tx, i.e. a Contract Monad with return type Tx.
  void takes any Monad and maps it to a Monad with return type (). This is useful if you don't care for the returned value: void $ submitTx tx :: Contract w s e ()
  handleError then takes the Monad and handles any errors with the specified error handler (e -&gt; Contract w s e' a). However, it doesn't change the return type of the Contract Monad. In case there is no error on runtime the return value is just passed through.
  payContract calls itself recursively on the last line of the do block in order to listen to the pay-endpoint indefinitely. Let's assume you'd leave out handleError and only use void $ submitTx tx your contract would crash on the first submission error.
  If you wouldn't use void, your program would still be valid, but your compiler would output a warning, because you didn't use the return value of submitTx tx.