Jump to content
McKay Development

Sending trade offers using only trade link


Recommended Posts

Basic and probably repetitive question here, sorry about that; I couldn't find anything on this. The documentation for TradeOfferManager.createOffer says we can pass in a trade link, but whenever I try, I get thrown an "Unknown SteamID Input Format" error. Is there a specific part of the link I need to pass into createOffer?

Link to comment
Share on other sites

Ahh, I see. Fixed it. Though I have another question now - if I'm getting the inventory contents of a user using the trade link & manager.getUserInventoryContents, what should I pass in as the first parameter? If I pass in the link itself, I get thrown an error. If i pass in the ID besides partner=xxxxxxxx, I get an HTTP error 404. If I pass in getUserInventoryContents("[u:1:" + accountid + "]" ...), where account ID is the partner ID in the tradelink, I also get an HTTP error 404. 

Link to comment
Share on other sites

You can either pass the steamID property from the offer, or the SteamID as you're doing in that last example, but the U needs to be capital. The ID type character is case-sensitive.

So, for example, either of these will work:

let offer = manager.createOffer(tradeUrl);
manager.getUserInventoryContents(offer.partner, 440, 2, true, (err, inv) => {
    console.log(`Got ${inv.length} items`);
});

// OR

manager.getUserInventoryContents(`[U:1:${accountid}]`, 440, 2, true, (err, inv) => {
    console.log(`Got ${inv.length} items`);
});

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...