Can we retry the transaction in case of a timeout or 500 error?

Yes, you may retry upto 3 times with an interval of 60 seconds between every retry. Please ensure to pass the same transaction_id in the path for retry requests.