skinsback.com API.
Node module forInstallation
npm install skinsback-sdk
Usage
const API = require('skinsback-sdk').API;
or
import {API} from 'skinsback-sdk';
Constructor options
-
options[shop_id]
: your shop_id key required -
options[secret_key]
: Your personalsecret key
for generate signature required. More about generate signature. -
options[apiUrl]
: url to API. Default:https://skinsback.com/api.php
.
Example
import {API} from 'skinsback-sdk';
const options = {
shop_id: 1490,
secret_key: 'XCvlP45Y2dH2UmHhk'
}
const api = new API(options);
Api methods
All methods of api return a Promise.
api.getBalance()
api.getCurrencies()
const params = {
starting: 15123132, /// Unix time starting
ending: 15125832 /// Unix time ending
}
api.getOrders(params)
const transaction_id = 65236
api.getOrderStatusByTransactionId(transaction_id)
const order_id = 636
api.getOrderStatusByOrderId(order_id)
const order_id = 636 ///Уникальный ID заказа в вашей системе
api.createOrder(order_id)
api.serverStatus()
api.getErrorCallbackList()
const game = 'csgo' // Game types 'dota2' or 'csgo'. Default: 'csgo'
api.getMarketPriceList([game])
const name = 'FAMAS' // name of skin
const game = 'csgo' // Game types 'dota2' or 'csgo'. Default: 'csgo'
api.getMarketPriceList(name, [game])
const name = 'FAMAS' // name of skin
const game = 'csgo' // Game types 'dota2' or 'csgo'. Default: 'csgo'
api.buyItemByNameAndSendToUser(name, [game])
const params = {
partner: string, // partner value from user trade URL
token: string, // token value from user trade URL
max_price: number, // max skin cost for buying (as USD). Used as a cost limiter.
name: string, // Skin name (market hash name)
game: string // Game types 'dota2' or 'csgo'. Default: 'csgo'
}
api.buyItemByIdAndSendToUser(params)
const buy_id = 12354322 /// buy_id from method buyItemByIdAndSendToUser or buyItemByNameAndSendToUser
api.getInfoAboutBoughtItem(buy_id)
const params = {
starting: 15123132, /// Unix time starting
ending: 15125832 /// Unix time ending
}
api.getBoughtItemsHistory(params)
WebSockets
Getting real-time changes for purchased skins.
Usage
const WebSockets = require('skinsback-sdk').WebSockets;
or
import {WebSockets} from 'skinsback-sdk';
Constructor options
-
options[shop_id]
: your shop_id key required -
options[secret_key]
: Your personalsecret key
for generate signature. More about generate signature required. -
options[socket_url]
: SkinsBack socket url Show more ####Example
import {WebSockets} from 'skinsback-sdk';
const options = {
shop_id: 1490,
secret_key: 'XCvlP45Y2dH2UmHhkl1',
socket_url: 'ws://185.71.65.202:7777'
}
const sockets = new WebSockets(options);
WebSockets methods
- Subscribing to socket events (Data arriving via sockets goes into the callback function argument as a parsed object)
sockets.subscribe(data => console.log(data));
- Calling a callback function when connecting to sockets
const cb = () => console.log('Connected')
sockets.connect(cb)
- Calling a callback function when disconnecting from sockets
const cb = () => console.log('Disconnected')
sockets.disconnect(cb)