Node.js implementation of Tinkoff REST API
npm i tinkoff-api --save
- Node >= 6
session
- get a new session ID to use it in all following commandssession_status
- get the status of a current session by IDsign_up
- request signing up by phone or credentialsconfirm
- confirm signing up by an SMS pinlevel_up
- enhance session access rights after signing up confirmationoperations
- get client operations for a certain period of time (requires signing up)
Start signing up:
import { TinkoffApi } from "../src";
const api = new TinkoffApi();
const {payload: sessionId} = await api.initializeSession();
console.log(`Session ID = ${sessionId}`);
const {operationTicket} = await api.signUp(sessionId, {username: 'Username', password: 'Password'});
// You will need Ticket ID to confirm signing up
console.log(`Ticket ID = ${operationTicket}`);
Then user will receive sms with 4-digits PIN. It will be used to continue registration:
const smsId = '0000'; // 4-digits PIN
await api.confirmSignUp(sessionId, operationTicket, smsId);
await api.levelUp(sessionId);
const {payload: {accessLevel}} = await api.checkSessionStatus(sessionId);
// Should be equal to CLIENT
console.log('Session access level = ${accessLevel}');