The length of time you should wait before taking legal action depends on your payment terms and policies, as well as applicable laws and regulations.
Generally, it's best to take action sooner rather than later to avoid further delays in payment.