steamstore
v2.4.0
Published
Interacts with the store.steampowered.com site for account management
Downloads
120
Maintainers
Readme
steamstore
A module for interacting with the Steam store site from Node.js. Currently not a lot of functionality is supported.
Logging In
This module cannot facilitate logins to the store site directly. You'll need to use something like
steam-user
or
steamcommunity
to login, and then use
setCookies
to set your login cookies in this module.
The cookies are the same for the store site and for the community site.
Patterns
Please read this section in its entirety before starting work with SteamStore
.
Callbacks and Promises
All methods listed in this document that accept a callback also return a Promise
. You may use either callbacks or
promises.
Legacy callbacks return their data spanning across multiple arguments. All promises (which return any data at all)
return a single object containing one or more properties. The names of these properties for legacy callbacks are the
names of the callback arguments listed in this readme. Newer callbacks return a single object response
argument, which
is identical to the promise output for that method.
Some methods indicate that their callback is required or optional. You are never required to use callbacks over promises, but if a callback is listed as optional then an unhandled promise rejection will not raise a warning/error. If a callback is listed as required and you neither supply a callback nor handle the promise rejection, then a promise rejection will raise a warning, and eventually a crash in a future Node.js release.
Properties
steamID
v1.1.0 or later is required to use this property
A SteamID
object for the currently logged-in user.
Methods
Constructor([options])
options
- An optional object containing zero or more of these properties:timeout
- The timeout to use for HTTP(S) requests, in milliseconds; default is 50000 (50 seconds)userAgent
- The user-agent header value; default is Chrome 56request
- Arequest
instance- This allows you to specify your own defaults on the request instance
- These options will always be overridden on the request instance:
jar
,timeout
,gzip
,headers['User-Agent']
Constructs a new instance of steamstore
. Example:
const SteamStore = require('steamstore');
let store = new SteamStore();
or
const SteamStore = require('steamstore');
let store = new SteamStore({"timeout": 30000});
setCookie(cookie)
cookie
- The cookie, in "name=value" string format
Sets a single cookie to steamstore
's internal cookie jar.
setCookies(cookies)
cookies
- An array of cookies, in "name=value" string format
Simply calls setCookie
for each cookie in the array.
getSessionID()
Returns the value of the sessionid
cookie, or creates a new random one and adds it to the cookie jar if not present.
addPhoneNumber(number[, bypassConfirmation], callback)
number
- Your phone number, with a leading plus and the country code- Example:
+18885550123
- Example:
bypassConfirmation
-true
if you want to ignore any confirmation-level errors (see below). Defaultfalse
callback
- A function to be called when the request completeserr
- AnError
object on failure, ornull
on success. Theconfirmation
property will betrue
if this is a confirmation-level error which can be overridden by settingbypassConfirmation
totrue
Adds a new phone number to your account. This triggers a verification Email to be sent. You can continue the process by
calling sendPhoneNumberVerificationMessage
sendPhoneNumberVerificationMessage(callback)
callback
- A function to be called when the request completeserr
- AnError
object on failure, ornull
on success
v2.3.0 or later is required to use this method
Call this method after you've clicked on the link in the email you received after you called addPhoneNumber()
.
This triggers a verification SMS to be sent. You can provide the verification code to
verifyPhoneNumber
to finalize the process.
resendVerificationSMS(callback)
callback
- A function to be called when the request completeserr
- AnError
object on failure, ornull
on success
Asks the Steam servers to resend the verification SMS to your pending-confirmation phone number. This will fail if you request it too soon after the last SMS was sent.
verifyPhoneNumber(code, callback)
code
- Your SMS verification codecallback
- A function to be called when the request completeserr
- AnError
object on failure, ornull
on success
Verify your pending-verification phone number using the SMS code.
removePhoneNumber(callback)
callback
- A function to be called when the request completeserr
- AnError
object on failure, ornull
on success
Starts the process to remove your phone number from your account. This will send an SMS verification code to your phone.
Call confirmRemovePhoneNumber
with the code to finalize the process.
confirmRemovePhoneNumber(code, callback)
code
- Your SMS verification codecallback
- A function to be called when the request completeserr
- AnError
object on failure, ornull
on success
Finalizes the process of removing your phone number from your account.
hasPhone(callback)
callback
- A function to be called when the request completeserr
- AnError
object on failure, ornull
on successhasVerifiedPhone
-true
if your account has a phone number linked,false
if notlastDigits
- If you have a phone number, this is a string containing the last 4 digits of your number
v1.3.0 or later is required to use this method
Checks whether your account has a phone number linked or not.
getAccountData(callback)
callback
- A function to be called when the request completeserr
- AnError
object on failure, ornull
on successownedApps
- An array containing the AppID of each app which your account ownsownedPackages
- An array containing the PackageID of each package which your account ownswishlistedApps
- An array containing the AppID of each app that's on your wishlistignoredApps
- An array containing the AppID of each app which you've clicked "Not Interested" onsuggestedTags
- An object containing the tags which are suggested for you. Keys are TagIDs, values are the tag names.
v1.1.0 or later is required to use this method
Gets information about products that your account owns, ignores, wants, or is recommended.
sendGift(giftID, recipient, recipientName, message, closing, signature[, callback])
giftID
- The gift's ID (also known as the asset ID of the item in your Steam gift inventory)recipient
- The recipient's SteamID (as aSteamID
object or string) to send it over Steam. You need to be friends with the user.recipientName
- The name of the recipient to put in the gift email/popupmessage
- The message to include in the email/popupclosing
- The closing to include in the email/popupsignature
- Your name to include in the email/popupcallback
- Optional. Called when the request completes.err
- AnError
object on failure, ornull
on success
v1.4.0 or later is required to use this method
Sends a Steam gift in your inventory to another user. The gift will remain in your inventory until the recipient accepts it. You can re-send a gift which you've already sent. Gifts don't have to be tradable in order to be sent.
createWallet(walletCode, billingAddress, callback)
walletCode
- A Steam wallet code you want to redeembillingAddress
- An object containing these properties:address
- Your street addresscity
- Your citycountry
- Your country code, e.g. "US"state
- Your state, e.g. "FL"postalCode
- Your postal/ZIP code
callback
- Required. Called when the requested data is available.err
- AnError
object if the request fails, ornull
otherwiseeresult
- AnEResult
value fromSteamStore.EResult
detail
- A value fromSteamStore.EPurchaseResult
orundefined
redeemable
-true
if this code can be redeemed,false
if notamount
- If redeemable, this is how much the code is worth, in its currency's lowest denomination (e.g. USD cents)currencyCode
- If redeemable, this is the currency ofamount
v1.7.0 or later is required to use this method
Before you can redeem a Steam Wallet code, your account needs to have a wallet. If you don't yet have a wallet you can
use this method to create one. Creating a wallet requires you to provide a wallet code, but the code won't be redeemed
until you actually call redeemWalletCode
.
checkWalletCode()
THIS METHOD IS NO LONGER FUNCTIONAL. IT WILL BE REMOVED IN A FUTURE RELEASE.
redeemWalletCode(walletCode[, callback])
walletCode
- The Steam wallet code you want to redeemcallback
- Optional. Called when the request completes.err
- AnError
object if the request fails, ornull
on successeresult
- AnEResult
value fromSteamStore.EResult
detail
- A value fromSteamStore.EPurchaseResult
orundefined
formattedNewWalletBalance
- If redeemed successfully, this is your new wallet balance as a string, formatted for human display (e.g.$20.00
)amount
- If redeemable, this is how much the code is worth, in its currency's lowest denomination (e.g. USD cents)
v1.5.0 or later is required to use this method
Attempts to redeem a Steam Wallet code on your account. This will call checkWalletCode
first, and if the code is not
redeemable, the callback will be invoked with an Error
passed as the first parameter. That Error
will have message
Wallet code is not valid
, with eresult
and purchaseresultdetail
properties defined on that Error
object.
getWalletBalance([callback])
callback
- Called when the request completes.err
- AnError
object if the request fails, ornull
on successresponse
- The response objectformattedBalance
- Your wallet balance as a string, formatted in your local currency (e.g."$1.23"
)
v2.1.0 or later is required to use this method
Gets your current Steam wallet balance.
setDisplayLanguages(primary[, secondary][, callback])
primary
- Your desired primary (display) language, as a string (e.g.english
ordanish
)secondary
- Your desired secondary languages, as an array of strings of the same format asprimary
callback
- Optional. Called when the request completes.err
- AnError
object on failure, ornull
on success
v1.5.0 or later is required to use this method
Updates your account's display languages for the Steam store.
addFreeLicense(subID[, callback])
subID
- The ID of the free-on-demand package you would like to claimcallback
- Optional. Called when the request completes.err
- AnError
object on failure, ornull
on success
v2.0.0 or later is required to use this method
Request to add an eligible free-on-demand package to your Steam account.
removeLicense(subID[, callback])
subID
- The ID of the complimentary license you would like to removecallback
- Optional. Called when the request completes.err
- AnError
objecton failure, ornull
on success
v2.2.0 or later is required to use this method
Removes an eligible complimentary license from your Steam account.