title: How to get discord user id from username using discord API
body: <p>I'm trying to automate adding users to Guilds after they pay a fee to join a specific server ( Guild ) , In the API documentation this is the only method available to add a user, it requires a user id </p>
  
  <pre><code>PUT /guilds/{guild.id}/members/{user.id}
  </code></pre>
  
  <p>The workflow I'm trying to implement is that the user types user's username, pays a fee, and then should be automatically added to the server, the average user will not be able to get user's ID by enabling developer mode on the discord app.</p>
  
  <p>Another possible solution is creating an invite, but all I can find about invites in the API documentation is get and delete invite, I could find an implementation in python <a href="https://discordpy.readthedocs.io/en/async/api.html#discord.Client.create_invite" rel="nofollow noreferrer">here</a> , but I'm not sure what API method is it calling, and I'm using PHP.</p>
  
  <p>Is there any way I can get the user's ID from the user's username ? and if not, is there any possible way to implement the mentioned workflow ?</p>