How to configure bitcoind to wait for X confirmations to make the payment submitted
You could use the listunspent RPC command. It takes a parameter which allows you to filter out UTXOs which have less than X confirmations.
Example (from the manpage):
bitcoin-cli listunspent 6 9999999 &quot;[\&quot;bc1INVALIDq09vm5lfy0j5reeulh4x5752q25uqqvz34hufd\&quot;,\&quot;bc1INVALIDq02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3\&quot;]&quot;