Braking a motor commanded by an IC H-bridge
Your TRIAC circuit looks like it should work OK, however it shouldn't be necessary because the L6203 automatically brakes the motor whenever both inputs are high or low (and ENABLE is active). If you apply PWM via IN1 or IN2 then it operates in Synchronous Rectification mode (called 'one phase chopping' in the datasheet) and the motor will be dynamically braked whenever it is running faster than the set speed. Simply turning PWM down to 0% will apply maximum braking.

Brake strength is limited by resistance of the braking circuit. In the L6203 two FETs are in series so the total braking resistance is about 0.6&ohm; (0.3&ohm; per FET). To be effective it needs to be much lower than the motor's internal resistance (which I am guessing is about 10&ohm; for a motor that normally draws 1.5A at 40V). If motor resistance is too low then braking current could exceed the driver's rating and an external brake circuit would be required. however the braking current won't normally go higher than the starting current - so if the L6203 is able to start your motor without being overloaded then it should also be able to stop it.

If you don't use PID and just stop the motor when the optical encoder reaches a particular position then it will run on past the stop point (you cannot prevent this from happening because the motor's braking torque is limited, so it cannot stop instantly). To stop at a precise point you need to start braking before it gets there. 

Exactly when you need to start braking depends on how fast the motor is going and the mechanical loading on it. The optical sensor tells you how fast it is going, and current draw or PWM required to get that speed gives you an idea of what load is applied. Using this information you could adjust the braking point to match the known stopping times under those conditions, either by calculating it in real time or using a lookup table of predetermined values.