An organization which purchases a license to the software, regardless of how many intermediaries there are, is called a licensee.

The organizations between your immediate customer and the licensees are called resellers.

If you want to distinguish between the humans using the software who work for a licensee, and the humans using the software who work for some other company with a business relationship to the licensee, you could call the first type in-house users or internal users, and the second type external users or third-party users.