
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
Methods of working with FNS API.
npm install fns-api axios
// App.js
import axios from 'axios';
import * as fns from 'fns-api';
const axiosInstance = axios.create({
baseURL: fns.BASE_URL,
headers: fns.defaultHeaders
});
const receiptApi = new fns.ReceiptApi(axiosInstance, '<your session id>');
receiptApi
.addReceiptQR({ qr: '<your qr data scanned from the receipt>' })
.then((response) => console.log(response.data))
.catch((e) => console.error(e));
Create LoginApi instance to work with login
import axios from 'axios';
import * as fns from 'fns-api';
const axiosInstance = axios.create({
baseURL: fns.BASE_URL,
headers: fns.defaultHeaders
});
const loginApi = new fns.LoginApi(axiosInstance);
Create ReceiptApi instance to work with receipts
import axios from 'axios';
import * as fns from 'fns-api';
// Get session id from login response
const sessionId = '<your session id>';
const axiosInstance = axios.create({
baseURL: fns.BASE_URL,
headers: fns.defaultHeaders
});
const receiptApi = new fns.ReceiptApi(axiosInstance, sessionId);
Session id you will receive after logging in any chosen way.
Login with the same credentials as on the site lkfl2.nalog.ru
// Your INN from https://lkfl2.nalog.ru
const inn = '<your inn>';
// Your password from https://lkfl2.nalog.ru
const password = '<your password>';
// Client secret
const clientSecret = '<client secret>';
loginApi
.loginLKFL({ inn, password, client_secret: clientSecret })
.then((response) => console.log(response.data))
.catch((e) => console.error(e));
To get information about a receipt, you must first add it
// Your receipt data
const fiscalData: fns.FiscalData = {
date: '2021-06-14T14:32',
operationType: 1,
sum: 43600,
fsId: '9982450301247855',
documentId: 65724,
fiscalSign: '7634185632'
};
receiptApi
.addReceipt({ fiscalData, sendToEmail: false })
.then((response) => console.log(response.data))
.catch((e) => console.error(e));
A receipt can be added according to the data from the QR-code
// QR-data string from the receipt
const qr = '<your qr data scanned from the receipt>';
receiptApi
.addReceiptQR({ qr })
.then((response) => console.log(response.data))
.catch((e) => console.error(e));
After adding, we can get detailed information about the receipt
// Get receipt id after call add receipt api
const receiptId = '<your receipt id>';
// Periodically make requests,
// until you get the ReceiptStatus.NPD_FOUND or ReceiptStatus.HAVE_COPY status.
receiptApi
.getReceipt(receiptId)
.then((response) => console.log(response.data))
.catch((e) => console.error(e));
More information about receipt status.
Get a list of all added receipts
receiptApi
.getReceipts()
.then((response) => console.log(response.data))
.catch((e) => console.error(e));
Remove a receipt from the list of added
// Receipt id
const receiptId = '<your receipt id>';
receiptApi
.removeReceipt(receiptId)
.then((response) => console.log(response.status))
.catch((e) => console.error(e));
Refresh session id and refresh token
// Get refresh token from login response
const refreshToken = '<your refresh token>';
// Client secret
const clientSecret = '<client secret>';
loginApi
.refreshTokens({ refresh_token: refreshToken, client_secret: clientSecret })
.then((response) => console.log(response.data))
.catch((e) => console.error(e));
Read API specification for full information.
Translations:
Licensed under the MIT License.
FAQs
Methods of working with FNS API
We found that fns-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.