Jump to content
McKay Development

How do i buy an item via httpRequestPost ?


SENPAY98K
 Share

Recommended Posts

What am i doing wrong in here ?

console.log('          ' + '[%s] [%s] Successfully Logged On (Session ID: %s)'.underline.bold.yellow, ii + 1, logOnOptions.accountName, sessionID); success++;

// Cancel options
var optionsCancel = {
    form: {
        sessionid: sessionID,
        buy_orderid: ''
    },
    json: true
};

// Buy options
var optionsKEY = {
    form: {
        sessionid: sessionID,
        currency: 1,
        appid: 440,
        market_hash_name: 'Mann Co. Supply Crate Key',
        price_total: config.KeysTotalPrice,
        quantity: config.KeysQuantity,
        billing_state: '',
        save_my_address: 0
    },
    json: true
};

// ------------------------------------------------------------------------------------------------------------------------------------ //
community.httpRequestPost(
    'https://steamcommunity.com/market/cancelbuyorder/', optionsCancel, function (err, res, data) {
        if (err) {
            console.log(' [%s] [%s] Failed to cancel previous buy orders.'.orange, ii + 1, logOnOptions.accountName); failedCancel++;
        }

        if (!err) {
            console.log(' [%s] [%s] Successfully canceled previous buy orders.'.orange, ii + 1, logOnOptions.accountName); successCancel++;
        }
    });

// Buying TF2 Keys -------------------------------------------------------------------------------------------------------------- //

if (KEYSBUY == 1) {
    community.httpRequestPost('https://steamcommunity.com/market/createbuyorder/', optionsKEY, function (err, res, data) {

        if (err) {
            console.log(' [%s] [%s] Failed to buy tf2 keys.'.orange + ' ==> Success: '.dim + ' %s '.red.bgWhite + ' <==', ii + 1, logOnOptions.accountName, data.success); failedKeys++;
        }

        if (!err) {
            if (data.success == true) {
                console.log(' [%s] [%s] Successfully bought tf2 keys. ==> '.green + ' ==> Success: '.white + ' %s '.grey.bgWhite + ' | OrderID: '.white + ' %s '.grey.bgWhite + ' <==', ii + 1, logOnOptions.accountName, data.success, data.buy_orderid); i++; successKeys++;
            }
        }
    });
};
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...
 Share

×
×
  • Create New...