Zend certified PHP/Magento developer

Magento 2.4.6 + Braintree: How to stop placing order when tranasaction is failed

Magento: 2.4.6

Braintree: 4.5.0

When a braintree transaction failed with a reason like ‘Processor Declined’ or ‘Gateway Rejected’, Magento also created an order with ‘Canceled’ status.
How to stop create an order when transaction failed?